From c91727108ec70019b0e1940e719bbf795ebf26c8 Mon Sep 17 00:00:00 2001 From: David Senoner Date: Tue, 26 May 2026 16:50:37 +0200 Subject: [PATCH] Replace usages of `ArrayHashMapUnmanaged` with `array_hash_map.Custom` --- lib/compiler/Maker/Fuzz.zig | 2 +- lib/compiler/Maker/Step.zig | 2 +- lib/compiler/Maker/Step/Compile.zig | 2 +- lib/compiler/Maker/Watch.zig | 6 +++--- lib/compiler/resinator/cvtres.zig | 6 +++--- lib/compiler/translate-c/Scope.zig | 2 +- lib/fuzzer.zig | 6 +++--- lib/std/Build/Cache.zig | 2 +- lib/std/debug/Coverage.zig | 4 ++-- lib/std/debug/MachOFile.zig | 4 ++-- lib/std/debug/SelfInfo/MachO.zig | 2 +- lib/std/process/Environ.zig | 2 +- src/Compilation.zig | 2 +- src/InternPool.zig | 2 +- src/Package/Fetch.zig | 2 +- src/Zcu.zig | 8 ++++---- src/codegen/spirv/Module.zig | 6 +++--- src/link/SpirV/lower_invocation_globals.zig | 2 +- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/compiler/Maker/Fuzz.zig b/lib/compiler/Maker/Fuzz.zig index 3c01be64d018fa6e8c2935faf49431db8d41fd19..44c3ccd2705799819cf189ae28053ddc9dce3583 100644 --- a/lib/compiler/Maker/Fuzz.zig +++ b/lib/compiler/Maker/Fuzz.zig @@ -273,7 +273,7 @@ pub fn serveSourcesTar(fuzz: *Fuzz, req: *std.http.Server.Request) !void { defer arena_state.deinit(); const arena = arena_state.allocator(); - const DedupTable = std.ArrayHashMapUnmanaged(Build.Cache.Path, void, Build.Cache.Path.TableAdapter, false); + const DedupTable = std.array_hash_map.Custom(Build.Cache.Path, void, Build.Cache.Path.TableAdapter, false); var dedup_table: DedupTable = .empty; defer dedup_table.deinit(gpa); diff --git a/lib/compiler/Maker/Step.zig b/lib/compiler/Maker/Step.zig index 6a6f5c1cf3718c2dce6c957283e528d7b0844ac4..40d82db57f6afbacc468e038f5c1e9f1487f15d9 100644 --- a/lib/compiler/Maker/Step.zig +++ b/lib/compiler/Maker/Step.zig @@ -180,7 +180,7 @@ pub const Inputs = struct { .table = .{}, }; - pub const Table = std.ArrayHashMapUnmanaged(Path, Files, Path.TableAdapter, false); + pub const Table = std.array_hash_map.Custom(Path, Files, Path.TableAdapter, false); /// The special file name "." means any changes inside the directory. pub const Files = std.ArrayList([]const u8); diff --git a/lib/compiler/Maker/Step/Compile.zig b/lib/compiler/Maker/Step/Compile.zig index db1fe80611bb25e2e3d834fe231662005ea06ae6..8db4b2be2a825da2fae3780043a35db491d28273 100644 --- a/lib/compiler/Maker/Step/Compile.zig +++ b/lib/compiler/Maker/Step/Compile.zig @@ -121,7 +121,7 @@ fn updateGeneratedFile( /// the root module. The root module is guaranteed to be first. const ModuleList = std.array_hash_map.Auto(Configuration.Module.Index, Configuration.String); /// Keyed on the first key in the module list. -pub const ModuleGraph = std.ArrayHashMapUnmanaged(ModuleList, void, ModuleListContext, false); +pub const ModuleGraph = std.array_hash_map.Custom(ModuleList, void, ModuleListContext, false); const ModuleListContext = struct { pub fn eql(ctx: @This(), a: ModuleList, b: ModuleList) bool { diff --git a/lib/compiler/Maker/Watch.zig b/lib/compiler/Maker/Watch.zig index 80466a132b5797221a347fc80be778e033e79409..fb8bca122804d0ba963f3827e29f38d69b40444e 100644 --- a/lib/compiler/Maker/Watch.zig +++ b/lib/compiler/Maker/Watch.zig @@ -27,7 +27,7 @@ pub const have_impl = Os != void; /// interested in noticing changes to. /// /// Value is generation. -const DirTable = std.ArrayHashMapUnmanaged(Cache.Path, void, Cache.Path.TableAdapter, false); +const DirTable = std.array_hash_map.Custom(Cache.Path, void, Cache.Path.TableAdapter, false); /// Special key of "." means any changes in this directory trigger the steps. const ReactionSet = std.array_hash_map.String(StepSet); @@ -49,7 +49,7 @@ const Os = switch (builtin.os.tag) { poll_fds: std.array_hash_map.Auto(MountId, posix.pollfd), const MountId = i32; - const HandleTable = std.ArrayHashMapUnmanaged(FileHandle, struct { mount_id: MountId, reaction_set: ReactionSet }, FileHandle.Adapter, false); + const HandleTable = std.array_hash_map.Custom(FileHandle, struct { mount_id: MountId, reaction_set: ReactionSet }, FileHandle.Adapter, false); const fan_mask: std.os.linux.fanotify.MarkMask = .{ .CLOSE_WRITE = true, @@ -314,7 +314,7 @@ const Os = switch (builtin.os.tag) { const windows = std.os.windows; /// Keyed differently but indexes correspond 1:1 with `dir_table`. - handle_table: std.ArrayHashMapUnmanaged(*Directory, void, Directory.TableAdapter, false), + handle_table: std.array_hash_map.Custom(*Directory, void, Directory.TableAdapter, false), ready_dirs: std.DoublyLinkedList, const FileId = struct { diff --git a/lib/compiler/resinator/cvtres.zig b/lib/compiler/resinator/cvtres.zig index ac6d9c23509cc998998c74f284fecb936b5b652e..244ab3f63596bfe01365761e1a5e2db084f48a2e 100644 --- a/lib/compiler/resinator/cvtres.zig +++ b/lib/compiler/resinator/cvtres.zig @@ -439,8 +439,8 @@ pub const ResourceDataEntry = extern struct { /// type -> name -> language const ResourceTree = struct { - type_to_name_map: std.ArrayHashMapUnmanaged(NameOrOrdinal, NameToLanguageMap, NameOrOrdinalHashContext, true), - rsrc_string_table: std.ArrayHashMapUnmanaged(NameOrOrdinal, void, NameOrOrdinalHashContext, true), + type_to_name_map: std.array_hash_map.Custom(NameOrOrdinal, NameToLanguageMap, NameOrOrdinalHashContext, true), + rsrc_string_table: std.array_hash_map.Custom(NameOrOrdinal, void, NameOrOrdinalHashContext, true), deduplicated_data: std.array_hash_map.String(u32), data_offsets: std.ArrayList(u32), rsrc02_len: u32, @@ -452,7 +452,7 @@ const ResourceTree = struct { original_index: usize, }; const LanguageToResourceMap = std.array_hash_map.Auto(Language, RelocatableResource); - const NameToLanguageMap = std.ArrayHashMapUnmanaged(NameOrOrdinal, LanguageToResourceMap, NameOrOrdinalHashContext, true); + const NameToLanguageMap = std.array_hash_map.Custom(NameOrOrdinal, LanguageToResourceMap, NameOrOrdinalHashContext, true); const NameOrOrdinalHashContext = struct { pub fn hash(self: @This(), v: NameOrOrdinal) u32 { diff --git a/lib/compiler/translate-c/Scope.zig b/lib/compiler/translate-c/Scope.zig index 01944189ba11844a05b4d3d75d2da22c32f0a4e9..80817634314b1e366a06b7b09e9b0bced31bdf1a 100644 --- a/lib/compiler/translate-c/Scope.zig +++ b/lib/compiler/translate-c/Scope.zig @@ -18,7 +18,7 @@ pub const ContainerMemberFns = struct { container_decl_ptr: *ast.Node, member_fns: std.ArrayList(*ast.Payload.Func) = .empty, }; -pub const ContainerMemberFnsHashMap = std.ArrayHashMapUnmanaged( +pub const ContainerMemberFnsHashMap = std.array_hash_map.Custom( aro.QualType, ContainerMemberFns, struct { diff --git a/lib/fuzzer.zig b/lib/fuzzer.zig index 37189a2b635f0a8c8774ee3d88d670e01bc37b90..acb23b66c58777bc2a6738081e23fcb52ee3c1d9 100644 --- a/lib/fuzzer.zig +++ b/lib/fuzzer.zig @@ -340,7 +340,7 @@ const Fuzzer = struct { quality_buf: []Input.Best, input_buf: []Input.Best.Map, }, - seen_uids: std.ArrayHashMapUnmanaged(Uid, struct { + seen_uids: std.array_hash_map.Custom(Uid, struct { slices: union { ints: std.ArrayList([]u64), bytes: std.ArrayList(Input.Data.Bytes), @@ -505,7 +505,7 @@ const Fuzzer = struct { } }; - pub const UidSlices = std.ArrayHashMapUnmanaged(Uid, struct { + pub const UidSlices = std.array_hash_map.Custom(Uid, struct { base: u32, len: u32, }, Uid.hashmap_ctx, false); @@ -584,7 +584,7 @@ const Fuzzer = struct { }; pub const Builder = struct { - uid_slices: std.ArrayHashMapUnmanaged(Uid, union { + uid_slices: std.array_hash_map.Custom(Uid, union { ints: std.MultiArrayList(struct { value: u64, order_i: u32, diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig index fe40251590f090d567744bcddd3451f62e52eac7..33c3148dd22080b5916100f4c3e210dabe38e14d 100644 --- a/lib/std/Build/Cache.zig +++ b/lib/std/Build/Cache.zig @@ -351,7 +351,7 @@ pub const Manifest = struct { }; }; - pub const Files = std.ArrayHashMapUnmanaged(File, void, FilesContext, false); + pub const Files = std.array_hash_map.Custom(File, void, FilesContext, false); pub const FilesContext = struct { pub fn hash(fc: FilesContext, file: File) u32 { diff --git a/lib/std/debug/Coverage.zig b/lib/std/debug/Coverage.zig index b3e16382cc45dff17d34b9bf57f7accb63d918e5..7bbc58a5b71f541734aafd75d75fdfb2c3858efb 100644 --- a/lib/std/debug/Coverage.zig +++ b/lib/std/debug/Coverage.zig @@ -15,13 +15,13 @@ const assert = std.debug.assert; /// String memory references the memory-mapped debug information. /// /// Protected by `mutex`. -directories: std.ArrayHashMapUnmanaged(String, void, String.MapContext, false), +directories: std.array_hash_map.Custom(String, void, String.MapContext, false), /// Provides a globally-scoped integer index for files. /// /// String memory references the memory-mapped debug information. /// /// Protected by `mutex`. -files: std.ArrayHashMapUnmanaged(File, void, File.MapContext, false), +files: std.array_hash_map.Custom(File, void, File.MapContext, false), string_bytes: std.ArrayList(u8), /// Protects the other fields. mutex: Io.Mutex, diff --git a/lib/std/debug/MachOFile.zig b/lib/std/debug/MachOFile.zig index d182f41c2cacc6394afa1d96b58bbc18db1f5d0d..369ee8c4bc41bf87ac8f9c3356a7ab1c532bfdad 100644 --- a/lib/std/debug/MachOFile.zig +++ b/lib/std/debug/MachOFile.zig @@ -305,7 +305,7 @@ const OFile = struct { symtab_raw: []align(1) const macho.nlist_64, /// All named symbols in `symtab_raw`. Stored `u32` key is the index into `symtab_raw`. Accessed /// through `SymbolAdapter`, so that the symbol name is used as the logical key. - symbols_by_name: std.ArrayHashMapUnmanaged(u32, void, void, true), + symbols_by_name: std.array_hash_map.Custom(u32, void, void, true), const SymbolAdapter = struct { strtab: []const u8, @@ -476,7 +476,7 @@ fn loadOFile(gpa: Allocator, io: Io, o_file_name: []const u8) !OFile { const symtab_raw: []align(1) const macho.nlist_64 = @ptrCast(mapped_ofile[symtab_cmd.symoff..][0..n_sym_bytes]); // TODO handle tentative (common) symbols - var symbols_by_name: std.ArrayHashMapUnmanaged(u32, void, void, true) = .empty; + var symbols_by_name: std.array_hash_map.Custom(u32, void, void, true) = .empty; defer symbols_by_name.deinit(gpa); try symbols_by_name.ensureUnusedCapacity(gpa, @intCast(symtab_raw.len)); for (symtab_raw, 0..) |sym_raw, sym_index| { diff --git a/lib/std/debug/SelfInfo/MachO.zig b/lib/std/debug/SelfInfo/MachO.zig index 431108cd3f6164769359902f1abccdec720516df..e771d7a9f5e45b3b5c217053f3394fd7b713a029 100644 --- a/lib/std/debug/SelfInfo/MachO.zig +++ b/lib/std/debug/SelfInfo/MachO.zig @@ -1,6 +1,6 @@ mutex: Io.Mutex, /// Accessed through `Module.Adapter`. -modules: std.ArrayHashMapUnmanaged(Module, void, Module.Context, false), +modules: std.array_hash_map.Custom(Module, void, Module.Context, false), pub const init: SelfInfo = .{ .mutex = .init, diff --git a/lib/std/process/Environ.zig b/lib/std/process/Environ.zig index bf0408c31ddc4eebf48a08dea54b6391a524e012..a2b2f4110f499171a09ffb42c3d631f7e48faee7 100644 --- a/lib/std/process/Environ.zig +++ b/lib/std/process/Environ.zig @@ -101,7 +101,7 @@ pub const Map = struct { array_hash_map: ArrayHashMap, allocator: Allocator, - const ArrayHashMap = std.ArrayHashMapUnmanaged([]const u8, []const u8, EnvNameHashContext, false); + const ArrayHashMap = std.array_hash_map.Custom([]const u8, []const u8, EnvNameHashContext, false); pub const Size = usize; diff --git a/src/Compilation.zig b/src/Compilation.zig index 5104d28efdbb2f8b3a2a879ad150c42f8403d34a..e4ba55d477b8cb05b46b63b74a51c01913c19469 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4360,7 +4360,7 @@ pub fn addModuleErrorMsg( // De-duplicate error notes. The main use case in mind for this is // too many "note: called from here" notes when eval branch quota is reached. - var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty; + var notes: std.array_hash_map.Custom(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty; defer notes.deinit(gpa); var last_note_loc: ?std.zig.Loc = null; diff --git a/src/InternPool.zig b/src/InternPool.zig index 061a501d1cae47f68580c1a80d8c93c5d654d306..48af82b0410200295484bbae55f9e09d78dfac29 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -1587,7 +1587,7 @@ fn getIndexMask(ip: *const InternPool, comptime BackingInt: type) u32 { return @as(u32, std.math.maxInt(BackingInt)) >> ip.tid_width; } -const FieldMap = std.ArrayHashMapUnmanaged(void, void, std.array_hash_map.AutoContext(void), false); +const FieldMap = std.array_hash_map.Custom(void, void, std.array_hash_map.AutoContext(void), false); /// An index into `maps` which might be `none`. pub const OptionalMapIndex = enum(u32) { diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index ffea64bb4457b40747a9549a2ab22b86cc088bd4..20e19cdaa7ad2e55b9ddb07f490df1ffdaa26eea 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -164,7 +164,7 @@ pub const JobQueue = struct { }; pub const Table = std.array_hash_map.Auto(Package.Hash, *Fetch); pub const UnlazySet = std.array_hash_map.Auto(Package.Hash, void); - pub const ForkSet = std.ArrayHashMapUnmanaged(Fork, void, Fork.Context, false); + pub const ForkSet = std.array_hash_map.Custom(Fork, void, Fork.Context, false); pub const Fork = struct { path: Cache.Path, diff --git a/src/Zcu.zig b/src/Zcu.zig index aa1bf5cf361aca385260556613a65a44321ac1f8..8c4ae90ac98908a9249baac8b40b82c1867f86bd 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -125,7 +125,7 @@ module_roots: std.array_hash_map.Auto(*Package.Module, File.Index.Optional) = .e /// /// Not serialized. This state is reconstructed during the first call to /// `Compilation.update` of the process for a given `Compilation`. -import_table: std.ArrayHashMapUnmanaged( +import_table: std.array_hash_map.Custom( File.Index, void, struct { @@ -162,7 +162,7 @@ multi_module_err: ?struct { /// on the `Compilation.Path` of the `EmbedFile`. /// /// This table owns all of the `*EmbedFile` memory, which is allocated into gpa. -embed_table: std.ArrayHashMapUnmanaged( +embed_table: std.array_hash_map.Custom( *EmbedFile, void, struct { @@ -840,9 +840,9 @@ pub const Namespace = struct { /// Will be a struct, enum, union, or opaque. owner_type: InternPool.Index, /// Members of the namespace which are marked `pub`. - pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, + pub_decls: std.array_hash_map.Custom(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// Members of the namespace which are *not* marked `pub`. - priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, + priv_decls: std.array_hash_map.Custom(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// All `comptime` declarations in this namespace. We store these purely so that incremental /// compilation can re-use the existing `ComptimeUnit`s when a namespace changes. comptime_decls: std.ArrayList(InternPool.ComptimeUnit.Id) = .empty, diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index efeb8954f98f4e32f6e3532e9e402bffe4f3ad05..a0897896ab28d9f9e3127c44a6077dc5bc2bd043 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -58,8 +58,8 @@ cache: struct { float_types: std.AutoHashMapUnmanaged(std.lang.Type.Float, Id) = .empty, vector_types: std.AutoHashMapUnmanaged(struct { Id, u32 }, Id) = .empty, array_types: std.AutoHashMapUnmanaged(struct { Id, Id }, Id) = .empty, - struct_types: std.ArrayHashMapUnmanaged(StructType, Id, StructType.HashContext, true) = .empty, - fn_types: std.ArrayHashMapUnmanaged(FnType, Id, FnType.HashContext, true) = .empty, + struct_types: std.array_hash_map.Custom(StructType, Id, StructType.HashContext, true) = .empty, + fn_types: std.array_hash_map.Custom(FnType, Id, FnType.HashContext, true) = .empty, capabilities: std.AutoHashMapUnmanaged(spec.Capability, void) = .empty, extensions: std.StringHashMapUnmanaged(void) = .empty, @@ -69,7 +69,7 @@ cache: struct { strings: std.array_hash_map.String(Id) = .empty, bool_const: [2]?Id = .{ null, null }, - constants: std.ArrayHashMapUnmanaged(Constant, Id, Constant.HashContext, true) = .empty, + constants: std.array_hash_map.Custom(Constant, Id, Constant.HashContext, true) = .empty, spirv_types: std.AutoHashMapUnmanaged(InternPool.Index, Id) = .empty, } = .{}, diff --git a/src/link/SpirV/lower_invocation_globals.zig b/src/link/SpirV/lower_invocation_globals.zig index 5c463b5afb57a71cbcc701982cfdf10b13fcd033..227be842b9a93959269edbf75e59068858a7a422 100644 --- a/src/link/SpirV/lower_invocation_globals.zig +++ b/src/link/SpirV/lower_invocation_globals.zig @@ -342,7 +342,7 @@ const ModuleBuilder = struct { entry_point_new_id_base: u32, /// A set of all function types in the new program. SPIR-V mandates that these are unique, /// and until a general type deduplication pass is programmed, we just handle it here via this. - function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .empty, + function_types: std.array_hash_map.Custom(FunctionType, ResultId, FunctionType.Context, true) = .empty, /// Maps functions to new information required for creating the module function_new_info: std.array_hash_map.Auto(ResultId, FunctionNewInfo) = .empty, /// Offset of the functions section in the new binary. -- 2.54.0