From d23e22c4161ad2a005ad4ee54877cc6908424d54 Mon Sep 17 00:00:00 2001 From: David Senoner Date: Tue, 26 May 2026 15:41:02 +0200 Subject: [PATCH] Replace usages of `StringArrayHashMapUnmanaged` with `array_hash_map.String` --- lib/compiler/Maker.zig | 2 +- lib/compiler/Maker/ScannedConfig.zig | 2 +- lib/compiler/Maker/Step/Compile.zig | 2 +- lib/compiler/Maker/Watch.zig | 2 +- lib/compiler/aro/aro/Compilation.zig | 4 ++-- lib/compiler/aro/aro/DepFile.zig | 2 +- lib/compiler/aro/aro/Preprocessor.zig | 2 +- lib/compiler/aro/aro/StringInterner.zig | 2 +- lib/compiler/aro/backend/Ir.zig | 6 +++--- lib/compiler/reduce/Walk.zig | 4 ++-- lib/compiler/resinator/cli.zig | 2 +- lib/compiler/resinator/cvtres.zig | 2 +- lib/compiler/translate-c/Scope.zig | 8 ++++---- lib/compiler/translate-c/Translator.zig | 6 +++--- lib/docs/wasm/Walk.zig | 8 ++++---- lib/docs/wasm/main.zig | 8 ++++---- lib/std/Build.zig | 6 +++--- lib/std/Build/Module.zig | 4 ++-- lib/std/Build/Step/Compile.zig | 2 +- lib/std/debug/MachOFile.zig | 4 ++-- lib/std/json/hashmap.zig | 8 ++++---- lib/std/process/Preopens.zig | 2 +- lib/std/zig/Ast/Render.zig | 2 +- src/Compilation.zig | 8 ++++---- src/Package/Fetch.zig | 4 ++-- src/Package/Manifest.zig | 8 ++++---- src/Package/Module.zig | 2 +- src/codegen/llvm/FuncGen.zig | 2 +- src/codegen/spirv/Assembler.zig | 4 ++-- src/codegen/spirv/Module.zig | 2 +- src/libs/mingw/implib.zig | 2 +- src/link.zig | 2 +- src/link/Elf.zig | 8 ++++---- src/link/MachO/Dylib.zig | 2 +- src/link/Wasm/Archive.zig | 2 +- src/main.zig | 12 ++++++------ 36 files changed, 74 insertions(+), 74 deletions(-) diff --git a/lib/compiler/Maker.zig b/lib/compiler/Maker.zig index cd3e43d332b2acb21ac76a8828d9426aba9a60d5..6c5136dac3cc11d4b9da2c3a6ced6391aee5ca43 100644 --- a/lib/compiler/Maker.zig +++ b/lib/compiler/Maker.zig @@ -481,7 +481,7 @@ pub fn main(init: process.Init.Minimal) !void { // maker process fails or crashes and it's helpful to be able to repeat // execution of the command line or otherwise inspect the configuration file. const c = &configuration; - var top_level_steps: std.StringArrayHashMapUnmanaged(Configuration.Step.Index) = .empty; + var top_level_steps: std.array_hash_map.String(Configuration.Step.Index) = .empty; for (configuration.steps, 0..) |*conf_step, step_index_usize| { if (conf_step.owner != .root) continue; const step_index: Configuration.Step.Index = @enumFromInt(step_index_usize); diff --git a/lib/compiler/Maker/ScannedConfig.zig b/lib/compiler/Maker/ScannedConfig.zig index c1e1ff18a90ba79e2331eae052deb4db61e5d164..f34303d2e56c1b6ea0cfe97f3ebed3d0d7f6c63c 100644 --- a/lib/compiler/Maker/ScannedConfig.zig +++ b/lib/compiler/Maker/ScannedConfig.zig @@ -8,7 +8,7 @@ const Serializer = std.zon.Serializer; const Graph = @import("Graph.zig"); configuration: Configuration, -top_level_steps: std.StringArrayHashMapUnmanaged(Configuration.Step.Index), +top_level_steps: std.array_hash_map.String(Configuration.Step.Index), path: []const u8, pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void { diff --git a/lib/compiler/Maker/Step/Compile.zig b/lib/compiler/Maker/Step/Compile.zig index 5f0589dc96c47e3be8e93697402fd3d7f1ba1e35..300bc19569289bbb62a50d5263b28a315d33d996 100644 --- a/lib/compiler/Maker/Step/Compile.zig +++ b/lib/compiler/Maker/Step/Compile.zig @@ -1127,7 +1127,7 @@ fn moduleNeedsCliArg(mod: *const Configuration.Module, conf: *const Configuratio const CliNamedModules = struct { modules: std.AutoArrayHashMapUnmanaged(Configuration.Module.Index, void), - names: std.StringArrayHashMapUnmanaged(void), + names: std.array_hash_map.String(void), /// Traverse the whole dependency graph and give every module a unique /// name, ideally one named after what it's called somewhere in the graph. diff --git a/lib/compiler/Maker/Watch.zig b/lib/compiler/Maker/Watch.zig index 603b9c911d696ad94f0ea5d250df07236cec78d6..51903377d6efec7649370c23558dcd9a2240cfe3 100644 --- a/lib/compiler/Maker/Watch.zig +++ b/lib/compiler/Maker/Watch.zig @@ -30,7 +30,7 @@ pub const have_impl = Os != void; const DirTable = std.ArrayHashMapUnmanaged(Cache.Path, void, Cache.Path.TableAdapter, false); /// Special key of "." means any changes in this directory trigger the steps. -const ReactionSet = std.StringArrayHashMapUnmanaged(StepSet); +const ReactionSet = std.array_hash_map.String(StepSet); const StepSet = std.AutoArrayHashMapUnmanaged(Configuration.Step.Index, Generation); const Generation = u8; diff --git a/lib/compiler/aro/aro/Compilation.zig b/lib/compiler/aro/aro/Compilation.zig index 978bbcffc8ea121ebbcdfd7bda6c9dfcd24e636d..f1dc72ae86c5f15611e77cbdbf69a28339d2b275 100644 --- a/lib/compiler/aro/aro/Compilation.zig +++ b/lib/compiler/aro/aro/Compilation.zig @@ -140,7 +140,7 @@ io: Io, cwd: std.Io.Dir, diagnostics: *Diagnostics, -sources: std.StringArrayHashMapUnmanaged(Source) = .empty, +sources: std.array_hash_map.String(Source) = .empty, source_aliases: std.ArrayList(Source) = .empty, /// Allocated into `gpa`, but keys are externally managed. search_path: std.ArrayList(Include) = .empty, @@ -159,7 +159,7 @@ builtins: Builtins = .{}, string_interner: StringInterner = .{}, interner: Interner = .{}, type_store: TypeStore = .{}, -pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty, +pragma_handlers: std.array_hash_map.String(*Pragma) = .empty, /// If this is not null, the directory containing the specified Source will be searched for includes /// Used by MS extensions which allow searching for includes relative to the directory of the main source file. ms_cwd_source_id: ?Source.Id = null, diff --git a/lib/compiler/aro/aro/DepFile.zig b/lib/compiler/aro/aro/DepFile.zig index a8f8d7cbaebe944adff461abadd38d3396fbf117..ba8d5c92b58e7d403544cc2a020e5420add2d979 100644 --- a/lib/compiler/aro/aro/DepFile.zig +++ b/lib/compiler/aro/aro/DepFile.zig @@ -6,7 +6,7 @@ pub const Format = enum { make, nmake }; const DepFile = @This(); target: []const u8, -deps: std.StringArrayHashMapUnmanaged(void) = .empty, +deps: std.array_hash_map.String(void) = .empty, format: Format, pub fn deinit(d: *DepFile, gpa: Allocator) void { diff --git a/lib/compiler/aro/aro/Preprocessor.zig b/lib/compiler/aro/aro/Preprocessor.zig index 6b52492e7d9a09a1650c7ffdf27cd6ffd09cdad4..2018da7bd023d347fdedccfadf029a25140b4054 100644 --- a/lib/compiler/aro/aro/Preprocessor.zig +++ b/lib/compiler/aro/aro/Preprocessor.zig @@ -23,7 +23,7 @@ const Tree = @import("Tree.zig"); const Token = Tree.Token; const TokenWithExpansionLocs = Tree.TokenWithExpansionLocs; -const DefineMap = std.StringArrayHashMapUnmanaged(Macro); +const DefineMap = std.array_hash_map.String(Macro); const RawTokenList = std.ArrayList(RawToken); const max_include_depth = 200; diff --git a/lib/compiler/aro/aro/StringInterner.zig b/lib/compiler/aro/aro/StringInterner.zig index e22ec23a467f20fcba6184628fc9ddddbb45a626..021bd3f602438587c91d8db63de450ba58098d65 100644 --- a/lib/compiler/aro/aro/StringInterner.zig +++ b/lib/compiler/aro/aro/StringInterner.zig @@ -19,7 +19,7 @@ pub const StringId = enum(u32) { } }; -table: std.StringArrayHashMapUnmanaged(void) = .empty, +table: std.array_hash_map.String(void) = .empty, pub fn deinit(si: *StringInterner, allocator: mem.Allocator) void { si.table.deinit(allocator); diff --git a/lib/compiler/aro/backend/Ir.zig b/lib/compiler/aro/backend/Ir.zig index ae4fa2a6d30fb4910b9409f0f11b6acf1256cdec..553e979b27fed6b59cbd8258b3e3dfe43cd235f0 100644 --- a/lib/compiler/aro/backend/Ir.zig +++ b/lib/compiler/aro/backend/Ir.zig @@ -7,7 +7,7 @@ const Object = @import("Object.zig"); const Ir = @This(); interner: *Interner, -decls: std.StringArrayHashMapUnmanaged(Decl), +decls: std.array_hash_map.String(Decl), pub const Decl = struct { instructions: std.MultiArrayList(Inst), @@ -26,7 +26,7 @@ pub const Builder = struct { arena: std.heap.ArenaAllocator, interner: *Interner, - decls: std.StringArrayHashMapUnmanaged(Decl) = .empty, + decls: std.array_hash_map.String(Decl) = .empty, instructions: std.MultiArrayList(Ir.Inst) = .empty, body: std.ArrayList(Ref) = .empty, alloc_count: u32 = 0, @@ -181,7 +181,7 @@ pub const Renderer = struct { ir: *const Ir, errors: ErrorList = .{}, - pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8); + pub const ErrorList = std.array_hash_map.String([]const u8); pub const Error = Allocator.Error || error{LowerFail}; diff --git a/lib/compiler/reduce/Walk.zig b/lib/compiler/reduce/Walk.zig index 955eed53259a8bf8802ca8301f35266ade07d37c..1873c23d77f6c08230e69743e5b6db09285284f4 100644 --- a/lib/compiler/reduce/Walk.zig +++ b/lib/compiler/reduce/Walk.zig @@ -44,7 +44,7 @@ pub const Transformation = union(enum) { imported_string: []const u8, /// Identifier names that must be renamed in the inlined code or else /// will cause ambiguous reference errors. - in_scope_names: std.StringArrayHashMapUnmanaged(void), + in_scope_names: std.array_hash_map.String(void), }; }; @@ -723,7 +723,7 @@ fn walkBuiltinCall( try w.transformations.append(.{ .inline_imported_file = .{ .builtin_call_node = call_node, .imported_string = imported_string, - .in_scope_names = try std.StringArrayHashMapUnmanaged(void).init( + .in_scope_names = try std.array_hash_map.String(void).init( w.arena, w.in_scope_names.keys(), &.{}, diff --git a/lib/compiler/resinator/cli.zig b/lib/compiler/resinator/cli.zig index f35e70ce6cccdd726d01426ba8c11216f94b81b1..7fa82ae65138cfdc7c08d43f592bdcd62d53f5fd 100644 --- a/lib/compiler/resinator/cli.zig +++ b/lib/compiler/resinator/cli.zig @@ -159,7 +159,7 @@ pub const Options = struct { default_language_id: ?u16 = null, default_code_page: ?SupportedCodePage = null, verbose: bool = false, - symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .empty, + symbols: std.array_hash_map.String(SymbolValue) = .empty, null_terminate_string_table_strings: bool = false, max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints, silent_duplicate_control_ids: bool = false, diff --git a/lib/compiler/resinator/cvtres.zig b/lib/compiler/resinator/cvtres.zig index 84364cea9fc0199e8ba35cd03301c4f4b1573bd6..7e36649440f91d7c624d2a511090f2dca0ad622c 100644 --- a/lib/compiler/resinator/cvtres.zig +++ b/lib/compiler/resinator/cvtres.zig @@ -441,7 +441,7 @@ pub const ResourceDataEntry = extern struct { const ResourceTree = struct { type_to_name_map: std.ArrayHashMapUnmanaged(NameOrOrdinal, NameToLanguageMap, NameOrOrdinalHashContext, true), rsrc_string_table: std.ArrayHashMapUnmanaged(NameOrOrdinal, void, NameOrOrdinalHashContext, true), - deduplicated_data: std.StringArrayHashMapUnmanaged(u32), + deduplicated_data: std.array_hash_map.String(u32), data_offsets: std.ArrayList(u32), rsrc02_len: u32, coff_options: CoffOptions, diff --git a/lib/compiler/translate-c/Scope.zig b/lib/compiler/translate-c/Scope.zig index 9e5f715600179973b8e0394e6a723e5f59ad2ba7..01944189ba11844a05b4d3d75d2da22c32f0a4e9 100644 --- a/lib/compiler/translate-c/Scope.zig +++ b/lib/compiler/translate-c/Scope.zig @@ -7,7 +7,7 @@ const Translator = @import("Translator.zig"); const Scope = @This(); -pub const SymbolTable = std.StringArrayHashMapUnmanaged(ast.Node); +pub const SymbolTable = std.array_hash_map.String(ast.Node); pub const AliasList = std.ArrayList(struct { alias: []const u8, name: []const u8, @@ -79,7 +79,7 @@ pub const Block = struct { /// will be used. This maps the variable's name to the Discard payload, so that if /// the variable is subsequently referenced we can indicate that the discard should /// be skipped during the intermediate AST -> Zig AST render step. - variable_discards: std.StringArrayHashMapUnmanaged(*ast.Payload.Discard), + variable_discards: std.array_hash_map.String(*ast.Payload.Discard), /// When the block corresponds to a function, keep track of the return type /// so that the return expression can be cast, if necessary @@ -209,7 +209,7 @@ pub const Root = struct { base: Scope, translator: *Translator, sym_table: SymbolTable, - blank_macros: std.StringArrayHashMapUnmanaged(void), + blank_macros: std.array_hash_map.String(void), nodes: std.ArrayList(ast.Node), container_member_fns_map: ContainerMemberFnsHashMap, @@ -267,7 +267,7 @@ pub const Root = struct { const gpa = root.translator.gpa; const arena = root.translator.arena; - var member_names: std.StringArrayHashMapUnmanaged(void) = .empty; + var member_names: std.array_hash_map.String(void) = .empty; defer member_names.deinit(gpa); for (root.container_member_fns_map.keys(), root.container_member_fns_map.values()) |container_qt, members| { // Get the container name diff --git a/lib/compiler/translate-c/Translator.zig b/lib/compiler/translate-c/Translator.zig index 9e27ee5e387dba6f072220bec6f64e3d0105e382..176f714272c3306edda91716e99a7489249315c8 100644 --- a/lib/compiler/translate-c/Translator.zig +++ b/lib/compiler/translate-c/Translator.zig @@ -123,7 +123,7 @@ anonymous_record_field_names: std.HashMapUnmanaged( /// a list of names that we found by visiting all the top level decls without /// translating them. The other maps are updated as we translate; this one is updated /// up front in a pre-processing step. -global_names: std.StringArrayHashMapUnmanaged(void) = .empty, +global_names: std.array_hash_map.String(void) = .empty, /// This is similar to `global_names`, but contains names which we would /// *like* to use, but do not strictly *have* to if they are unavailable. @@ -132,11 +132,11 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .empty, /// may be mangled. /// This is distinct from `global_names` so we can detect at a type /// declaration whether or not the name is available. -weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, +weak_global_names: std.array_hash_map.String(void) = .empty, /// Set of identifiers known to refer to typedef declarations. /// Used when parsing macros. -typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, +typedefs: std.array_hash_map.String(void) = .empty, /// The lhs lval of a compound assignment expression. compound_assign_dummy: ?ZigNode = null, diff --git a/lib/docs/wasm/Walk.zig b/lib/docs/wasm/Walk.zig index f0601e6438f80ce8951146fcbb3024bd8f7cee0b..4716e34fd257b2fe2b17a4ae65334ed9bbc81a65 100644 --- a/lib/docs/wasm/Walk.zig +++ b/lib/docs/wasm/Walk.zig @@ -10,9 +10,9 @@ const Oom = error{OutOfMemory}; pub const Decl = @import("Decl.zig"); -pub var files: std.StringArrayHashMapUnmanaged(File) = .empty; +pub var files: std.array_hash_map.String(File) = .empty; pub var decls: std.ArrayList(Decl) = .empty; -pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .empty; +pub var modules: std.array_hash_map.String(File.Index) = .empty; file: File.Index, @@ -465,8 +465,8 @@ pub const Scope = struct { const Namespace = struct { base: Scope = .{ .tag = .namespace }, parent: *Scope, - names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, - doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, + names: std.array_hash_map.String(Ast.Node.Index) = .empty, + doctests: std.array_hash_map.String(Ast.Node.Index) = .empty, decl_index: Decl.Index, }; diff --git a/lib/docs/wasm/main.zig b/lib/docs/wasm/main.zig index bee3e4acbcc370261f3b137d40584ea2ad2f8065..d73f2a68160ff2db197067d8cc39e40e4998a824 100644 --- a/lib/docs/wasm/main.zig +++ b/lib/docs/wasm/main.zig @@ -264,7 +264,7 @@ const ErrorIdentifier = packed struct(u64) { }; var string_result: ArrayList(u8) = .empty; -var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .empty; +var error_set_result: std.array_hash_map.String(ErrorIdentifier) = .empty; export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) { return Slice(ErrorIdentifier).init(decl_error_set_fallible(decl_index) catch @panic("OOM")); @@ -305,7 +305,7 @@ fn sort_error_set_result() void { fn addErrorsFromDecl( decl_index: Decl.Index, - out: *std.StringArrayHashMapUnmanaged(ErrorIdentifier), + out: *std.array_hash_map.String(ErrorIdentifier), ) Oom!void { switch (decl_index.get().categorize()) { .error_set => |node| try addErrorsFromExpr(decl_index, out, node), @@ -316,7 +316,7 @@ fn addErrorsFromDecl( fn addErrorsFromExpr( decl_index: Decl.Index, - out: *std.StringArrayHashMapUnmanaged(ErrorIdentifier), + out: *std.array_hash_map.String(ErrorIdentifier), node: Ast.Node.Index, ) Oom!void { const decl = decl_index.get(); @@ -343,7 +343,7 @@ fn addErrorsFromExpr( fn addErrorsFromNode( decl_index: Decl.Index, - out: *std.StringArrayHashMapUnmanaged(ErrorIdentifier), + out: *std.array_hash_map.String(ErrorIdentifier), node: Ast.Node.Index, ) Oom!void { const decl = decl_index.get(); diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 2261aa4c9241452fb2f5f54e4d41cb01de7d5ef0..294afe78402e37ce50a53fac9460c4c74acfd5be 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -33,7 +33,7 @@ user_input_options: UserInputOptionsMap, available_options_map: std.array_hash_map.String(AvailableOption) = .empty, invalid_user_input: bool, default_step: *Step, -top_level_steps: std.StringArrayHashMapUnmanaged(*Step.TopLevel), +top_level_steps: std.array_hash_map.String(*Step.TopLevel), /// Path to the directory containing build.zig. root: Cache.Path, debug_log_scopes: []const []const u8 = &.{}, @@ -78,11 +78,11 @@ pub const Graph = struct { io: Io, /// Process lifetime. arena: Allocator, - system_integration_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .empty, + system_integration_options: std.array_hash_map.String(SystemLibraryMode) = .empty, system_package_mode: bool = false, zig_exe: []const u8, environ_map: process.Environ.Map, - needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .empty, + needed_lazy_dependencies: std.array_hash_map.String(void) = .empty, /// Information about the native target. Computed before build() is invoked. host: ResolvedTarget, dependency_cache: InitializedDepMap = .empty, diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 35a07f1eb88b911f2a0303ee556de7de1bb43e93..d96a691658aa739471fc5f47561e1a3f2fdeb7e1 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -12,7 +12,7 @@ root_source_file: ?LazyPath, /// The modules that are mapped into this module's import table. /// Use `addImport` rather than modifying this field directly in order to /// maintain step dependency edges. -import_table: std.StringArrayHashMapUnmanaged(*Module), +import_table: std.array_hash_map.String(*Module), resolved_target: ?std.Build.ResolvedTarget = null, optimize: ?std.builtin.OptimizeMode = null, @@ -22,7 +22,7 @@ c_macros: ArrayList([]const u8), include_dirs: ArrayList(IncludeDir), lib_paths: ArrayList(LazyPath), rpaths: ArrayList(RPath), -frameworks: std.StringArrayHashMapUnmanaged(LinkFrameworkOptions), +frameworks: std.array_hash_map.String(LinkFrameworkOptions), link_objects: ArrayList(LinkObject), strip: ?bool, diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index d74b633fdc9e087e9638fdbb566ba8ad6f0ca9ab..f5d5083363488fb612711ff142d4d8ad49e330c8 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -187,7 +187,7 @@ entry: Entry = .default, /// List of symbols forced as undefined in the symbol table /// thus forcing their resolution by the linker. /// Corresponds to `-u ` for ELF/MachO and `/include:` for COFF/PE. -force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), +force_undefined_symbols: std.array_hash_map.String(void), /// Overrides the default stack size stack_size: ?u64 = null, diff --git a/lib/std/debug/MachOFile.zig b/lib/std/debug/MachOFile.zig index 4b2fb524bcdab99802e9001b0d340d484e6f86e2..3b7ec7cc703e5afbee51d8e551210c93b91ffaf4 100644 --- a/lib/std/debug/MachOFile.zig +++ b/lib/std/debug/MachOFile.zig @@ -115,7 +115,7 @@ pub fn load(gpa: Allocator, io: Io, path: []const u8, arch: std.Target.Cpu.Arch) // necessary because we prefer to use STAB ("symbolic debugging table") symbols, // but they might not be present, so we track normal symbols too. // Indices match 1-1 with those of `symbols`. - var symbol_names: std.StringArrayHashMapUnmanaged(void) = .empty; + var symbol_names: std.array_hash_map.String(void) = .empty; defer symbol_names.deinit(gpa); try symbol_names.ensureUnusedCapacity(gpa, symtab.nsyms); @@ -380,7 +380,7 @@ test { fn appendStabSymbol( symbols: *std.ArrayList(Symbol), - symbol_names: *std.StringArrayHashMapUnmanaged(void), + symbol_names: *std.array_hash_map.String(void), strings: []const u8, last_sym: Symbol, ) void { diff --git a/lib/std/json/hashmap.zig b/lib/std/json/hashmap.zig index be4e9bd2dd5a4359c6ed2a0b6be704369fc314e9..7a88f6ea0d3a2ae1d40f2a9a522ebd0bc0ec63f4 100644 --- a/lib/std/json/hashmap.zig +++ b/lib/std/json/hashmap.zig @@ -6,20 +6,20 @@ const innerParse = @import("static.zig").innerParse; const innerParseFromValue = @import("static.zig").innerParseFromValue; const Value = @import("dynamic.zig").Value; -/// A thin wrapper around `std.StringArrayHashMapUnmanaged` that implements +/// A thin wrapper around `std.array_hash_map.String` that implements /// `jsonParse`, `jsonParseFromValue`, and `jsonStringify`. /// This is useful when your JSON schema has an object with arbitrary data keys /// instead of comptime-known struct field names. pub fn ArrayHashMap(comptime T: type) type { return struct { - map: std.StringArrayHashMapUnmanaged(T) = .empty, + map: std.array_hash_map.String(T) = .empty, pub fn deinit(self: *@This(), allocator: Allocator) void { self.map.deinit(allocator); } pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() { - var map: std.StringArrayHashMapUnmanaged(T) = .empty; + var map: std.array_hash_map.String(T) = .empty; errdefer map.deinit(allocator); if (.object_begin != try source.next()) return error.UnexpectedToken; @@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type { pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() { if (source != .object) return error.UnexpectedToken; - var map: std.StringArrayHashMapUnmanaged(T) = .empty; + var map: std.array_hash_map.String(T) = .empty; errdefer map.deinit(allocator); var it = source.object.iterator(); diff --git a/lib/std/process/Preopens.zig b/lib/std/process/Preopens.zig index 3baf696ee9a5d95dbf2bed352ea4867e8c3fde8c..6a7337a31e9bcaf207af9d2ab501448a95649cc3 100644 --- a/lib/std/process/Preopens.zig +++ b/lib/std/process/Preopens.zig @@ -16,7 +16,7 @@ pub const empty: Preopens = switch (native_os) { pub const Map = switch (native_os) { // Indexed by file descriptor number. - .wasi => std.StringArrayHashMapUnmanaged(void), + .wasi => std.array_hash_map.String(void), else => void, }; diff --git a/lib/std/zig/Ast/Render.zig b/lib/std/zig/Ast/Render.zig index 6c8c0c9143d147b0f2483148f305c7b00c1cf304..8f5b2e2c276f5b8680fb56173154bcbdbf8966e6 100644 --- a/lib/std/zig/Ast/Render.zig +++ b/lib/std/zig/Ast/Render.zig @@ -42,7 +42,7 @@ pub const Fixups = struct { /// These nodes will be replaced with a different node. replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty, /// Change all identifier names matching the key to be value instead. - rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .empty, + rename_identifiers: std.array_hash_map.String([]const u8) = .empty, /// All `@import` builtin calls which refer to a file path will be prefixed /// with this path. diff --git a/src/Compilation.zig b/src/Compilation.zig index 03a6904413a05002277d8b93701a0957582f8226..3edac6ceb817a26b64a66f6630a44ea2151e605d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -87,7 +87,7 @@ link_inputs: []const link.Input, framework_dirs: []const []const u8, /// These are only for DLLs dependencies fulfilled by the `.def` files shipped /// with Zig. Static libraries are provided as `link.Input` values. -windows_libs: std.StringArrayHashMapUnmanaged(void), +windows_libs: std.array_hash_map.String(void), /// The number of items in `windows_libs` which we have already built. All items at or after this /// index will be built in `performAllTheWork`. windows_libs_num_done: u32, @@ -101,7 +101,7 @@ native_system_include_paths: []const []const u8, /// List of symbols forced as undefined in the symbol table /// thus forcing their resolution by the linker. /// Corresponds to `-u ` for ELF/MachO and `/include:` for COFF/PE. -force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), +force_undefined_symbols: std.array_hash_map.String(void), c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty, win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct { @@ -1604,7 +1604,7 @@ pub const CreateOptions = struct { /// implementations still do. lib_directories: []const Cache.Directory = &.{}, rpath_list: []const []const u8 = &[0][]const u8{}, - symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty, + symbol_wrap_set: std.array_hash_map.String(void) = .empty, c_source_files: []const CSourceFile = &.{}, rc_source_files: []const RcSourceFile = &.{}, manifest_file: ?[]const u8 = null, @@ -1683,7 +1683,7 @@ pub const CreateOptions = struct { skip_linker_dependencies: bool = false, hash_style: link.File.Lld.Elf.HashStyle = .both, entry: Entry = .default, - force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty, + force_undefined_symbols: std.array_hash_map.String(void) = .empty, stack_size: ?u64 = null, image_base: ?u64 = null, version: ?std.SemanticVersion = null, diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index d5e0c3e615c687b775852f65a9d1df9393ec852e..8523b4e65a6b82c4667ac34a5a7c76f227a2986f 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -1725,7 +1725,7 @@ fn computeHash(f: *Fetch, pkg_path: Cache.Path, filter: Filter) RunError!Compute // Track directories which had any files deleted from them so that empty directories // can be deleted. - var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty; + var sus_dirs: std.array_hash_map.String(void) = .empty; defer sus_dirs.deinit(gpa); var walker = try root_dir.walk(gpa); @@ -2002,7 +2002,7 @@ fn normalizePath(bytes: []u8) void { } const Filter = struct { - include_paths: std.StringArrayHashMapUnmanaged(void) = .empty, + include_paths: std.array_hash_map.String(void) = .empty, /// sub_path is relative to the package root. pub fn includePath(self: *const Filter, sub_path: []const u8) bool { diff --git a/src/Package/Manifest.zig b/src/Package/Manifest.zig index 05ca2a31c25d6939bc190f19b79cc9d53bea2647..849fc742ec5c7b5be02a2895f54f99fece02b2ff 100644 --- a/src/Package/Manifest.zig +++ b/src/Package/Manifest.zig @@ -42,9 +42,9 @@ name: []const u8, id: u32, version: std.SemanticVersion, version_node: Ast.Node.Index, -dependencies: std.StringArrayHashMapUnmanaged(Dependency), +dependencies: std.array_hash_map.String(Dependency), dependencies_node: Ast.Node.OptionalIndex, -paths: std.StringArrayHashMapUnmanaged(void), +paths: std.array_hash_map.String(void), minimum_zig_version: ?std.SemanticVersion, errors: []ErrorMessage, @@ -144,9 +144,9 @@ const Parse = struct { id: u32, version: std.SemanticVersion, version_node: Ast.Node.Index, - dependencies: std.StringArrayHashMapUnmanaged(Dependency), + dependencies: std.array_hash_map.String(Dependency), dependencies_node: Ast.Node.OptionalIndex, - paths: std.StringArrayHashMapUnmanaged(void), + paths: std.array_hash_map.String(void), allow_missing_paths_field: bool, minimum_zig_version: ?std.SemanticVersion, diff --git a/src/Package/Module.zig b/src/Package/Module.zig index 9241293d1dd480b1d9046c26e2d419a6874d2556..92eca47b9f7614daa4b2cd7cf0b6293b23d04350 100644 --- a/src/Package/Module.zig +++ b/src/Package/Module.zig @@ -35,7 +35,7 @@ cc_argv: []const []const u8, structured_cfg: bool, no_builtin: bool, -pub const Deps = std.StringArrayHashMapUnmanaged(*Module); +pub const Deps = std.array_hash_map.String(*Module); pub const Tree = struct { /// Each `Package` exposes a `Module` with build.zig as its root source file. diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index bb4cf80cbd012dada91626adcaf4393326309771..dd4e5113f96d733f4e265000c05d749643a33200 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -2513,7 +2513,7 @@ fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) TodoError!Builder.Value { var llvm_param_i: usize = 0; var total_i: usize = 0; - var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty; + var name_map: std.array_hash_map.String(u16) = .empty; try name_map.ensureUnusedCapacity(arena, max_param_count); var it = unwrapped_asm.iterateOutputs(); diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 3a63df8424350c53aa627ef67210f6036b50014b..fa6a000153f2fe720d13f7bdab0ba3a624955e7c 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -35,8 +35,8 @@ inst: struct { return null; } } = .{}, -value_map: std.StringArrayHashMapUnmanaged(AsmValue) = .{}, -inst_map: std.StringArrayHashMapUnmanaged(void) = .empty, +value_map: std.array_hash_map.String(AsmValue) = .{}, +inst_map: std.array_hash_map.String(void) = .empty, const Operand = union(enum) { /// Any 'simple' 32-bit value. This could be a mask or diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 0280b2885dc55a620ea7fedf66279c0ff8480802..e2f9e81f16019e99b38e347cdaf61173173e6072 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -66,7 +66,7 @@ cache: struct { extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, Id) = .empty, decorations: std.AutoHashMapUnmanaged(struct { Id, spec.Decoration }, void) = .empty, builtins: std.AutoHashMapUnmanaged(struct { spec.BuiltIn, spec.StorageClass }, Decl.Index) = .empty, - strings: std.StringArrayHashMapUnmanaged(Id) = .empty, + strings: std.array_hash_map.String(Id) = .empty, bool_const: [2]?Id = .{ null, null }, constants: std.ArrayHashMapUnmanaged(Constant, Id, Constant.HashContext, true) = .empty, diff --git a/src/libs/mingw/implib.zig b/src/libs/mingw/implib.zig index 525129fe119046846ca70b798bd38fc0c4cfadd0..0c4ca824863cd411435e2bb44aee95d9a4a680f9 100644 --- a/src/libs/mingw/implib.zig +++ b/src/libs/mingw/implib.zig @@ -245,7 +245,7 @@ pub fn getMembers( }; var renames: std.ArrayList(DeferredExport) = .empty; defer renames.deinit(allocator); - var regular_imports: std.StringArrayHashMapUnmanaged([]const u8) = .empty; + var regular_imports: std.array_hash_map.String([]const u8) = .empty; defer regular_imports.deinit(allocator); for (module_def.exports.items) |*e| { diff --git a/src/link.zig b/src/link.zig index 3d64c248a96a8fc811f28d840000b68359477063..59a8ea84d86e14b1d8f880f52dfa4565e85f6c21 100644 --- a/src/link.zig +++ b/src/link.zig @@ -471,7 +471,7 @@ pub const File = struct { /// wrapper for a system function. The wrapper function should be called /// __wrap_symbol. If it wishes to call the system function, it should call /// __real_symbol. - symbol_wrap_set: std.StringArrayHashMapUnmanaged(void), + symbol_wrap_set: std.array_hash_map.String(void), compatibility_version: ?std.SemanticVersion, diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 4c50caf8f2b6d363a37c3f6189b0975b8bdd1451..878f428f99321f74fc58aa43bc6ee13cc8ea46b7 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2,7 +2,7 @@ pub const Atom = @import("Elf/Atom.zig"); base: link.File, zig_object: ?*ZigObject, -rpath_table: std.StringArrayHashMapUnmanaged(void), +rpath_table: std.array_hash_map.String(void), image_base: u64, z_nodelete: bool, z_notext: bool, @@ -30,7 +30,7 @@ file_handles: std.ArrayList(File.Handle) = .empty, zig_object_index: ?File.Index = null, linker_defined_index: ?File.Index = null, objects: std.ArrayList(File.Index) = .empty, -shared_objects: std.StringArrayHashMapUnmanaged(File.Index) = .empty, +shared_objects: std.array_hash_map.String(File.Index) = .empty, /// List of all output sections and their associated metadata. sections: std.MultiArrayList(Section) = .{}, @@ -249,7 +249,7 @@ pub fn createEmpty( const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic; const default_sym_version: elf.Versym = if (is_dyn_lib or comp.config.rdynamic) .GLOBAL else .LOCAL; - var rpath_table: std.StringArrayHashMapUnmanaged(void) = .empty; + var rpath_table: std.array_hash_map.String(void) = .empty; try rpath_table.entries.resize(arena, options.rpath_list.len); @memcpy(rpath_table.entries.items(.key), options.rpath_list); try rpath_table.reIndex(arena); @@ -1112,7 +1112,7 @@ fn parseDso( io: Io, diags: *Diags, dso: link.Input.Dso, - shared_objects: *std.StringArrayHashMapUnmanaged(File.Index), + shared_objects: *std.array_hash_map.String(File.Index), files: *std.MultiArrayList(File.Entry), target: *const std.Target, ) !void { diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index d1f79b5ab73e7efd293858116a2031453d57c8de..3125cd538d01636f3c181c48282c354de53f388a 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -14,7 +14,7 @@ symbols: std.ArrayList(Symbol) = .empty, symbols_extra: std.ArrayList(u32) = .empty, globals: std.ArrayList(MachO.SymbolResolver.Index) = .empty, dependents: std.ArrayList(Id) = .empty, -rpaths: std.StringArrayHashMapUnmanaged(void) = .empty, +rpaths: std.array_hash_map.String(void) = .empty, umbrella: File.Index, platform: ?MachO.Platform = null, diff --git a/src/link/Wasm/Archive.zig b/src/link/Wasm/Archive.zig index 9424eeabf41db56a8fab5fc55464bdeaba49d857..65a1ee313b8c6bc5e8710728cd877284c47b544f 100644 --- a/src/link/Wasm/Archive.zig +++ b/src/link/Wasm/Archive.zig @@ -12,7 +12,7 @@ toc: Toc, /// Key points into `LazyArchive` `file_contents`. /// Value is allocated with gpa. -const Toc = std.StringArrayHashMapUnmanaged(std.ArrayList(u32)); +const Toc = std.array_hash_map.String(std.ArrayList(u32)); const ARMAG = std.elf.ARMAG; const ARFMAG = std.elf.ARFMAG; diff --git a/src/main.zig b/src/main.zig index 142d5facb6dddffaa242d3e94081f2d549eb7a5c..a385082f129da03472486e3a83347c6a247fe724 100644 --- a/src/main.zig +++ b/src/main.zig @@ -987,7 +987,7 @@ fn buildOutputType( var test_no_exec = false; var test_execve = false; var entry: Compilation.CreateOptions.Entry = .default; - var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty; + var force_undefined_symbols: std.array_hash_map.String(void) = .empty; var stack_size: ?u64 = null; var image_base: ?u64 = null; var link_eh_frame_hdr = false; @@ -1024,7 +1024,7 @@ fn buildOutputType( // These are before resolving sysroot. var extra_cflags: std.ArrayList([]const u8) = .empty; var extra_rcflags: std.ArrayList([]const u8) = .empty; - var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty; + var symbol_wrap_set: std.array_hash_map.String(void) = .empty; var rc_includes: std.zig.RcIncludes = .any; var manifest_file: ?[]const u8 = null; var linker_export_symbol_names: std.ArrayList([]const u8) = .empty; @@ -3592,7 +3592,7 @@ fn buildOutputType( defer file_system_inputs.deinit(gpa); // Deduplicate rpath entries - var rpath_dedup = std.StringArrayHashMapUnmanaged(void){}; + var rpath_dedup = std.array_hash_map.String(void){}; for (create_module.rpath_list.items) |rpath| { try rpath_dedup.put(arena, rpath, {}); } @@ -3896,7 +3896,7 @@ fn buildOutputType( const CreateModule = struct { dirs: Compilation.Directories, - modules: std.StringArrayHashMapUnmanaged(CliModule), + modules: std.array_hash_map.String(CliModule), opts: Compilation.Config.Options, dynamic_linker: ?[]const u8, object_format: ?[]const u8, @@ -3908,7 +3908,7 @@ const CreateModule = struct { /// link_libcpp, and then the libraries are filtered into /// `unresolved_link_inputs` and `windows_libs`. cli_link_inputs: std.ArrayList(link.UnresolvedInput), - windows_libs: std.StringArrayHashMapUnmanaged(void), + windows_libs: std.array_hash_map.String(void), /// The local variable `unresolved_link_inputs` is fed into library /// resolution, mutating the input array, and producing this data as /// output. Allocated with gpa. @@ -3926,7 +3926,7 @@ const CreateModule = struct { lib_dir_args: std.ArrayList([]const u8), libc_installation: ?LibCInstallation, want_native_include_dirs: bool, - frameworks: std.StringArrayHashMapUnmanaged(Framework), + frameworks: std.array_hash_map.String(Framework), native_system_include_paths: []const []const u8, framework_dirs: std.ArrayList([]const u8), rpath_list: std.ArrayList([]const u8), -- 2.54.0