diff --git a/doc/langref/wasi_args.zig b/doc/langref/wasi_args.zig index b1e7e7cbb1..6801e67f0c 100644 --- a/doc/langref/wasi_args.zig +++ b/doc/langref/wasi_args.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() !void { - var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; const gpa = general_purpose_allocator.allocator(); const args = try std.process.argsAlloc(gpa); defer std.process.argsFree(gpa, args); diff --git a/doc/langref/wasi_preopens.zig b/doc/langref/wasi_preopens.zig index 2a2f8dcd1b..5a167bc8db 100644 --- a/doc/langref/wasi_preopens.zig +++ b/doc/langref/wasi_preopens.zig @@ -2,7 +2,7 @@ const std = @import("std"); const fs = std.fs; pub fn main() !void { - var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; const gpa = general_purpose_allocator.allocator(); var arena_instance = std.heap.ArenaAllocator.init(gpa); diff --git a/lib/compiler/aro/aro/CodeGen.zig b/lib/compiler/aro/aro/CodeGen.zig index 0c87e7f744..bfffb4117e 100644 --- a/lib/compiler/aro/aro/CodeGen.zig +++ b/lib/compiler/aro/aro/CodeGen.zig @@ -42,11 +42,11 @@ node_tag: []const Tree.Tag, node_data: []const Tree.Node.Data, node_ty: []const Type, wip_switch: *WipSwitch = undefined, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, -phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, -record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{}, -record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty, +phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty, +record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .empty, +record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .empty, cond_dummy_ty: ?Interner.Ref = null, bool_invert: bool = false, bool_end_label: Ir.Ref = .none, diff --git a/lib/compiler/aro/aro/Compilation.zig b/lib/compiler/aro/aro/Compilation.zig index 6093bdc509..22ca9c00ed 100644 --- a/lib/compiler/aro/aro/Compilation.zig +++ b/lib/compiler/aro/aro/Compilation.zig @@ -93,13 +93,13 @@ gpa: Allocator, diagnostics: Diagnostics, environment: Environment = .{}, -sources: std.StringArrayHashMapUnmanaged(Source) = .{}, -include_dirs: std.ArrayListUnmanaged([]const u8) = .{}, -system_include_dirs: std.ArrayListUnmanaged([]const u8) = .{}, +sources: std.StringArrayHashMapUnmanaged(Source) = .empty, +include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, +system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, target: std.Target = @import("builtin").target, -pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{}, +pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty, langopts: LangOpts = .{}, -generated_buf: std.ArrayListUnmanaged(u8) = .{}, +generated_buf: std.ArrayListUnmanaged(u8) = .empty, builtins: Builtins = .{}, types: struct { wchar: Type = undefined, diff --git a/lib/compiler/aro/aro/Diagnostics.zig b/lib/compiler/aro/aro/Diagnostics.zig index 3039a45ef8..eb3bb31ee8 100644 --- a/lib/compiler/aro/aro/Diagnostics.zig +++ b/lib/compiler/aro/aro/Diagnostics.zig @@ -221,7 +221,7 @@ pub const Options = struct { const Diagnostics = @This(); -list: std.ArrayListUnmanaged(Message) = .{}, +list: std.ArrayListUnmanaged(Message) = .empty, arena: std.heap.ArenaAllocator, fatal_errors: bool = false, options: Options = .{}, diff --git a/lib/compiler/aro/aro/Driver.zig b/lib/compiler/aro/aro/Driver.zig index 7bdfd2c81e..c89dafe002 100644 --- a/lib/compiler/aro/aro/Driver.zig +++ b/lib/compiler/aro/aro/Driver.zig @@ -25,8 +25,8 @@ pub const Linker = enum { const Driver = @This(); comp: *Compilation, -inputs: std.ArrayListUnmanaged(Source) = .{}, -link_objects: std.ArrayListUnmanaged([]const u8) = .{}, +inputs: std.ArrayListUnmanaged(Source) = .empty, +link_objects: std.ArrayListUnmanaged([]const u8) = .empty, output_name: ?[]const u8 = null, sysroot: ?[]const u8 = null, system_defines: Compilation.SystemDefinesMode = .include_system_defines, diff --git a/lib/compiler/aro/aro/Hideset.zig b/lib/compiler/aro/aro/Hideset.zig index ad8a089ae6..98712e41e2 100644 --- a/lib/compiler/aro/aro/Hideset.zig +++ b/lib/compiler/aro/aro/Hideset.zig @@ -51,10 +51,10 @@ pub const Index = enum(u32) { _, }; -map: std.AutoHashMapUnmanaged(Identifier, Index) = .{}, +map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty, /// Used for computing union/intersection of two lists; stored here so that allocations can be retained /// until hideset is deinit'ed -tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{}, +tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty, linked_list: Item.List = .{}, comp: *const Compilation, diff --git a/lib/compiler/aro/aro/InitList.zig b/lib/compiler/aro/aro/InitList.zig index 7e9f73e8a3..5a5765216c 100644 --- a/lib/compiler/aro/aro/InitList.zig +++ b/lib/compiler/aro/aro/InitList.zig @@ -23,7 +23,7 @@ const Item = struct { const InitList = @This(); -list: std.ArrayListUnmanaged(Item) = .{}, +list: std.ArrayListUnmanaged(Item) = .empty, node: NodeIndex = .none, tok: TokenIndex = 0, diff --git a/lib/compiler/aro/aro/Parser.zig b/lib/compiler/aro/aro/Parser.zig index 0a8907b23a..00857c65e1 100644 --- a/lib/compiler/aro/aro/Parser.zig +++ b/lib/compiler/aro/aro/Parser.zig @@ -109,7 +109,7 @@ param_buf: std.ArrayList(Type.Func.Param), enum_buf: std.ArrayList(Type.Enum.Field), record_buf: std.ArrayList(Type.Record.Field), attr_buf: std.MultiArrayList(TentativeAttribute) = .{}, -attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{}, +attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty, field_attr_buf: std.ArrayList([]const Attribute), /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. @@ -117,7 +117,7 @@ field_attr_buf: std.ArrayList([]const Attribute), /// Items are removed if the type is subsequently completed with a definition. /// We only store the first tentative definition that uses a given type because this map is only used /// for issuing an error message, and correcting the first error for a type will fix all of them for that type. -tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{}, +tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .empty, // configuration and miscellaneous info no_eval: bool = false, @@ -174,7 +174,7 @@ record: struct { } } } = .{}, -record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{}, +record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .empty, @"switch": ?*Switch = null, in_loop: bool = false, pragma_pack: ?u8 = null, diff --git a/lib/compiler/aro/aro/Preprocessor.zig b/lib/compiler/aro/aro/Preprocessor.zig index 63bf085836..a8eb74a4a8 100644 --- a/lib/compiler/aro/aro/Preprocessor.zig +++ b/lib/compiler/aro/aro/Preprocessor.zig @@ -95,7 +95,7 @@ counter: u32 = 0, expansion_source_loc: Source.Location = undefined, poisoned_identifiers: std.StringHashMap(void), /// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any -include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{}, +include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty, /// Store `keyword_define` and `keyword_undef` tokens. /// Used to implement preprocessor debug dump options diff --git a/lib/compiler/aro/aro/SymbolStack.zig b/lib/compiler/aro/aro/SymbolStack.zig index be2ee20cb0..4c01e3d356 100644 --- a/lib/compiler/aro/aro/SymbolStack.zig +++ b/lib/compiler/aro/aro/SymbolStack.zig @@ -33,14 +33,14 @@ pub const Kind = enum { constexpr, }; -scopes: std.ArrayListUnmanaged(Scope) = .{}, +scopes: std.ArrayListUnmanaged(Scope) = .empty, /// allocations from nested scopes are retained after popping; `active_len` is the number /// of currently-active items in `scopes`. active_len: usize = 0, const Scope = struct { - vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{}, - tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{}, + vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty, + tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty, fn deinit(self: *Scope, allocator: Allocator) void { self.vars.deinit(allocator); diff --git a/lib/compiler/aro/aro/pragmas/gcc.zig b/lib/compiler/aro/aro/pragmas/gcc.zig index 91ab750b4c..a382f4daac 100644 --- a/lib/compiler/aro/aro/pragmas/gcc.zig +++ b/lib/compiler/aro/aro/pragmas/gcc.zig @@ -19,7 +19,7 @@ pragma: Pragma = .{ .preserveTokens = preserveTokens, }, original_options: Diagnostics.Options = .{}, -options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .{}, +options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .empty, const Directive = enum { warning, diff --git a/lib/compiler/aro/aro/pragmas/pack.zig b/lib/compiler/aro/aro/pragmas/pack.zig index 81d1dbc59a..24cfcc81a2 100644 --- a/lib/compiler/aro/aro/pragmas/pack.zig +++ b/lib/compiler/aro/aro/pragmas/pack.zig @@ -15,7 +15,7 @@ pragma: Pragma = .{ .parserHandler = parserHandler, .preserveTokens = preserveTokens, }, -stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{}, +stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .empty, pub fn init(allocator: mem.Allocator) !*Pragma { var pack = try allocator.create(Pack); diff --git a/lib/compiler/aro/aro/toolchains/Linux.zig b/lib/compiler/aro/aro/toolchains/Linux.zig index a7d8c71bef..9666c8e3b0 100644 --- a/lib/compiler/aro/aro/toolchains/Linux.zig +++ b/lib/compiler/aro/aro/toolchains/Linux.zig @@ -11,7 +11,7 @@ const system_defaults = @import("system_defaults"); const Linux = @This(); distro: Distro.Tag = .unknown, -extra_opts: std.ArrayListUnmanaged([]const u8) = .{}, +extra_opts: std.ArrayListUnmanaged([]const u8) = .empty, gcc_detector: GCCDetector = .{}, pub fn discover(self: *Linux, tc: *Toolchain) !void { diff --git a/lib/compiler/aro/backend/Interner.zig b/lib/compiler/aro/backend/Interner.zig index 631ec8ee16..818afe8691 100644 --- a/lib/compiler/aro/backend/Interner.zig +++ b/lib/compiler/aro/backend/Interner.zig @@ -8,14 +8,14 @@ const Limb = std.math.big.Limb; const Interner = @This(); -map: std.AutoArrayHashMapUnmanaged(void, void) = .{}, +map: std.AutoArrayHashMapUnmanaged(void, void) = .empty, items: std.MultiArrayList(struct { tag: Tag, data: u32, }) = .{}, -extra: std.ArrayListUnmanaged(u32) = .{}, -limbs: std.ArrayListUnmanaged(Limb) = .{}, -strings: std.ArrayListUnmanaged(u8) = .{}, +extra: std.ArrayListUnmanaged(u32) = .empty, +limbs: std.ArrayListUnmanaged(Limb) = .empty, +strings: std.ArrayListUnmanaged(u8) = .empty, const KeyAdapter = struct { interner: *const Interner, diff --git a/lib/compiler/aro/backend/Ir.zig b/lib/compiler/aro/backend/Ir.zig index e694a23c9a..e90bf56cbd 100644 --- a/lib/compiler/aro/backend/Ir.zig +++ b/lib/compiler/aro/backend/Ir.zig @@ -26,9 +26,9 @@ pub const Builder = struct { arena: std.heap.ArenaAllocator, interner: *Interner, - decls: std.StringArrayHashMapUnmanaged(Decl) = .{}, + decls: std.StringArrayHashMapUnmanaged(Decl) = .empty, instructions: std.MultiArrayList(Ir.Inst) = .{}, - body: std.ArrayListUnmanaged(Ref) = .{}, + body: std.ArrayListUnmanaged(Ref) = .empty, alloc_count: u32 = 0, arg_count: u32 = 0, current_label: Ref = undefined, diff --git a/lib/compiler/aro/backend/Object/Elf.zig b/lib/compiler/aro/backend/Object/Elf.zig index 2a303d348c..9b4f347de5 100644 --- a/lib/compiler/aro/backend/Object/Elf.zig +++ b/lib/compiler/aro/backend/Object/Elf.zig @@ -5,7 +5,7 @@ const Object = @import("../Object.zig"); const Section = struct { data: std.ArrayList(u8), - relocations: std.ArrayListUnmanaged(Relocation) = .{}, + relocations: std.ArrayListUnmanaged(Relocation) = .empty, flags: u64, type: u32, index: u16 = undefined, @@ -37,9 +37,9 @@ const Elf = @This(); obj: Object, /// The keys are owned by the Codegen.tree -sections: std.StringHashMapUnmanaged(*Section) = .{}, -local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, -global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, +sections: std.StringHashMapUnmanaged(*Section) = .empty, +local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty, +global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty, unnamed_symbol_mangle: u32 = 0, strtab_len: u64 = strtab_default.len, arena: std.heap.ArenaAllocator, diff --git a/lib/compiler/aro_translate_c.zig b/lib/compiler/aro_translate_c.zig index 4255989416..910d12d32b 100644 --- a/lib/compiler/aro_translate_c.zig +++ b/lib/compiler/aro_translate_c.zig @@ -16,22 +16,22 @@ const Context = @This(); gpa: mem.Allocator, arena: mem.Allocator, -decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{}, +decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty, alias_list: AliasList, global_scope: *Scope.Root, mangle_count: u32 = 0, /// Table of record decls that have been demoted to opaques. -opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{}, +opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty, /// Table of unnamed enums and records that are child types of typedefs. -unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{}, +unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty, /// Needed to decide if we are parsing a typename -typedefs: std.StringArrayHashMapUnmanaged(void) = .{}, +typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, /// This one is different than the root scope's name table. This contains /// 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) = .{}, +global_names: std.StringArrayHashMapUnmanaged(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. @@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{}, /// 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) = .{}, +weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, pattern_list: PatternList, tree: Tree, @@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_ } fn getTypeStr(c: *Context, ty: Type) ![]const u8 { - var buf: std.ArrayListUnmanaged(u8) = .{}; + var buf: std.ArrayListUnmanaged(u8) = .empty; defer buf.deinit(c.gpa); const w = buf.writer(c.gpa); try ty.print(c.mapper, c.comp.langopts, w); @@ -1793,7 +1793,7 @@ pub fn main() !void { defer arena_instance.deinit(); const arena = arena_instance.allocator(); - var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; const gpa = general_purpose_allocator.allocator(); const args = try std.process.argsAlloc(arena); diff --git a/lib/compiler/aro_translate_c/ast.zig b/lib/compiler/aro_translate_c/ast.zig index 853fcb748c..8cd331d294 100644 --- a/lib/compiler/aro_translate_c/ast.zig +++ b/lib/compiler/aro_translate_c/ast.zig @@ -808,7 +808,7 @@ const Context = struct { gpa: Allocator, buf: std.ArrayList(u8), nodes: std.zig.Ast.NodeList = .{}, - extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .{}, + extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .empty, tokens: std.zig.Ast.TokenList = .{}, fn addTokenFmt(c: *Context, tag: TokenTag, comptime format: []const u8, args: anytype) Allocator.Error!TokenIndex { diff --git a/lib/compiler/build_runner.zig b/lib/compiler/build_runner.zig index 690c937545..4d643222d7 100644 --- a/lib/compiler/build_runner.zig +++ b/lib/compiler/build_runner.zig @@ -336,7 +336,7 @@ pub fn main() !void { } if (graph.needed_lazy_dependencies.entries.len != 0) { - var buffer: std.ArrayListUnmanaged(u8) = .{}; + var buffer: std.ArrayListUnmanaged(u8) = .empty; for (graph.needed_lazy_dependencies.keys()) |k| { try buffer.appendSlice(arena, k); try buffer.append(arena, '\n'); @@ -1173,7 +1173,7 @@ pub fn printErrorMessages( // Provide context for where these error messages are coming from by // printing the corresponding Step subtree. - var step_stack: std.ArrayListUnmanaged(*Step) = .{}; + var step_stack: std.ArrayListUnmanaged(*Step) = .empty; defer step_stack.deinit(gpa); try step_stack.append(gpa, failing_step); while (step_stack.items[step_stack.items.len - 1].dependants.items.len != 0) { diff --git a/lib/compiler/objcopy.zig b/lib/compiler/objcopy.zig index b48fb52e82..ac609c94e5 100644 --- a/lib/compiler/objcopy.zig +++ b/lib/compiler/objcopy.zig @@ -15,7 +15,7 @@ pub fn main() !void { defer arena_instance.deinit(); const arena = arena_instance.allocator(); - var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; const gpa = general_purpose_allocator.allocator(); const args = try std.process.argsAlloc(arena); diff --git a/lib/compiler/reduce.zig b/lib/compiler/reduce.zig index ad536376da..826c2bccf7 100644 --- a/lib/compiler/reduce.zig +++ b/lib/compiler/reduce.zig @@ -51,7 +51,7 @@ pub fn main() !void { defer arena_instance.deinit(); const arena = arena_instance.allocator(); - var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; const gpa = general_purpose_allocator.allocator(); const args = try std.process.argsAlloc(arena); @@ -109,7 +109,7 @@ pub fn main() !void { const root_source_file_path = opt_root_source_file_path orelse fatal("missing root source file path argument; see -h for usage", .{}); - var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .{}; + var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .empty; try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1); interestingness_argv.appendAssumeCapacity(checker_path); interestingness_argv.appendSliceAssumeCapacity(argv); diff --git a/lib/compiler/resinator/ast.zig b/lib/compiler/resinator/ast.zig index d55d91e52c..31250ea71e 100644 --- a/lib/compiler/resinator/ast.zig +++ b/lib/compiler/resinator/ast.zig @@ -28,7 +28,7 @@ pub const Tree = struct { }; pub const CodePageLookup = struct { - lookup: std.ArrayListUnmanaged(CodePage) = .{}, + lookup: std.ArrayListUnmanaged(CodePage) = .empty, allocator: Allocator, default_code_page: CodePage, diff --git a/lib/compiler/resinator/cli.zig b/lib/compiler/resinator/cli.zig index 6aebf9a022..1223b069d7 100644 --- a/lib/compiler/resinator/cli.zig +++ b/lib/compiler/resinator/cli.zig @@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void { } pub const Diagnostics = struct { - errors: std.ArrayListUnmanaged(ErrorDetails) = .{}, + errors: std.ArrayListUnmanaged(ErrorDetails) = .empty, allocator: Allocator, pub const ErrorDetails = struct { arg_index: usize, arg_span: ArgSpan = .{}, - msg: std.ArrayListUnmanaged(u8) = .{}, + msg: std.ArrayListUnmanaged(u8) = .empty, type: Type = .err, print_args: bool = true, @@ -132,13 +132,13 @@ pub const Options = struct { allocator: Allocator, input_filename: []const u8 = &[_]u8{}, output_filename: []const u8 = &[_]u8{}, - extra_include_paths: std.ArrayListUnmanaged([]const u8) = .{}, + extra_include_paths: std.ArrayListUnmanaged([]const u8) = .empty, ignore_include_env_var: bool = false, preprocess: Preprocess = .yes, default_language_id: ?u16 = null, default_code_page: ?CodePage = null, verbose: bool = false, - symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .{}, + symbols: std.StringArrayHashMapUnmanaged(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/compile.zig b/lib/compiler/resinator/compile.zig index f9e211a4dc..58259cf4c4 100644 --- a/lib/compiler/resinator/compile.zig +++ b/lib/compiler/resinator/compile.zig @@ -3004,9 +3004,9 @@ test "limitedWriter basic usage" { } pub const FontDir = struct { - fonts: std.ArrayListUnmanaged(Font) = .{}, + fonts: std.ArrayListUnmanaged(Font) = .empty, /// To keep track of which ids are set and where they were set from - ids: std.AutoHashMapUnmanaged(u16, Token) = .{}, + ids: std.AutoHashMapUnmanaged(u16, Token) = .empty, pub const Font = struct { id: u16, @@ -3112,7 +3112,7 @@ pub const StringTablesByLanguage = struct { /// when the first STRINGTABLE for the language was defined, and all blocks for a given /// language are written contiguously. /// Using an ArrayHashMap here gives us this property for free. - tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .{}, + tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .empty, pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void { self.tables.deinit(allocator); @@ -3143,10 +3143,10 @@ pub const StringTable = struct { /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second). /// Using an ArrayHashMap here gives us this property for free. - blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .{}, + blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .empty, pub const Block = struct { - strings: std.ArrayListUnmanaged(Token) = .{}, + strings: std.ArrayListUnmanaged(Token) = .empty, set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 }, memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING), characteristics: u32, diff --git a/lib/compiler/resinator/errors.zig b/lib/compiler/resinator/errors.zig index 90744e9934..67a5a09d3b 100644 --- a/lib/compiler/resinator/errors.zig +++ b/lib/compiler/resinator/errors.zig @@ -13,10 +13,10 @@ const builtin = @import("builtin"); const native_endian = builtin.cpu.arch.endian(); pub const Diagnostics = struct { - errors: std.ArrayListUnmanaged(ErrorDetails) = .{}, + errors: std.ArrayListUnmanaged(ErrorDetails) = .empty, /// Append-only, cannot handle removing strings. /// Expects to own all strings within the list. - strings: std.ArrayListUnmanaged([]const u8) = .{}, + strings: std.ArrayListUnmanaged([]const u8) = .empty, allocator: std.mem.Allocator, pub fn init(allocator: std.mem.Allocator) Diagnostics { @@ -968,7 +968,7 @@ pub fn renderErrorMessage(allocator: std.mem.Allocator, writer: anytype, tty_con const CorrespondingLines = struct { worth_printing_note: bool = true, worth_printing_lines: bool = true, - lines: std.ArrayListUnmanaged(u8) = .{}, + lines: std.ArrayListUnmanaged(u8) = .empty, lines_is_error_message: bool = false, pub fn init(allocator: std.mem.Allocator, cwd: std.fs.Dir, err_details: ErrorDetails, lines_for_comparison: []const u8, corresponding_span: SourceMappings.CorrespondingSpan, corresponding_file: []const u8) !CorrespondingLines { diff --git a/lib/compiler/resinator/main.zig b/lib/compiler/resinator/main.zig index 4159ad03e3..a918081226 100644 --- a/lib/compiler/resinator/main.zig +++ b/lib/compiler/resinator/main.zig @@ -10,7 +10,7 @@ const renderErrorMessage = @import("utils.zig").renderErrorMessage; const aro = @import("aro"); pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer std.debug.assert(gpa.deinit() == .ok); const allocator = gpa.allocator(); @@ -432,7 +432,7 @@ fn cliDiagnosticsToErrorBundle( }); var cur_err: ?ErrorBundle.ErrorMessage = null; - var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{}; + var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty; defer cur_notes.deinit(gpa); for (diagnostics.errors.items) |err_details| { switch (err_details.type) { @@ -474,10 +474,10 @@ fn diagnosticsToErrorBundle( try bundle.init(gpa); errdefer bundle.deinit(); - var msg_buf: std.ArrayListUnmanaged(u8) = .{}; + var msg_buf: std.ArrayListUnmanaged(u8) = .empty; defer msg_buf.deinit(gpa); var cur_err: ?ErrorBundle.ErrorMessage = null; - var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{}; + var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty; defer cur_notes.deinit(gpa); for (diagnostics.errors.items) |err_details| { switch (err_details.type) { @@ -587,7 +587,7 @@ fn aroDiagnosticsToErrorBundle( var msg_writer = MsgWriter.init(gpa); defer msg_writer.deinit(); var cur_err: ?ErrorBundle.ErrorMessage = null; - var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{}; + var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty; defer cur_notes.deinit(gpa); for (comp.diagnostics.list.items) |msg| { switch (msg.kind) { diff --git a/lib/compiler/resinator/parse.zig b/lib/compiler/resinator/parse.zig index e6fe228dcc..3bfd7fd7e2 100644 --- a/lib/compiler/resinator/parse.zig +++ b/lib/compiler/resinator/parse.zig @@ -111,7 +111,7 @@ pub const Parser = struct { /// current token is unchanged. /// The returned slice is allocated by the parser's arena fn parseCommonResourceAttributes(self: *Self) ![]Token { - var common_resource_attributes = std.ArrayListUnmanaged(Token){}; + var common_resource_attributes: std.ArrayListUnmanaged(Token) = .empty; while (true) { const maybe_common_resource_attribute = try self.lookaheadToken(.normal); if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) { @@ -131,7 +131,7 @@ pub const Parser = struct { /// current token is unchanged. /// The returned slice is allocated by the parser's arena fn parseOptionalStatements(self: *Self, resource: Resource) ![]*Node { - var optional_statements = std.ArrayListUnmanaged(*Node){}; + var optional_statements: std.ArrayListUnmanaged(*Node) = .empty; while (true) { const lookahead_token = try self.lookaheadToken(.normal); if (lookahead_token.id != .literal) break; @@ -445,7 +445,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var accelerators = std.ArrayListUnmanaged(*Node){}; + var accelerators: std.ArrayListUnmanaged(*Node) = .empty; while (true) { const lookahead = try self.lookaheadToken(.normal); @@ -463,7 +463,7 @@ pub const Parser = struct { const idvalue = try self.parseExpression(.{ .allowed_types = .{ .number = true } }); - var type_and_options = std.ArrayListUnmanaged(Token){}; + var type_and_options: std.ArrayListUnmanaged(Token) = .empty; while (true) { if (!(try self.parseOptionalToken(.comma))) break; @@ -528,7 +528,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var controls = std.ArrayListUnmanaged(*Node){}; + var controls: std.ArrayListUnmanaged(*Node) = .empty; defer controls.deinit(self.state.allocator); while (try self.parseControlStatement(resource)) |control_node| { // The number of controls must fit in a u16 in order for it to @@ -587,7 +587,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var buttons = std.ArrayListUnmanaged(*Node){}; + var buttons: std.ArrayListUnmanaged(*Node) = .empty; defer buttons.deinit(self.state.allocator); while (try self.parseToolbarButtonStatement()) |button_node| { // The number of buttons must fit in a u16 in order for it to @@ -645,7 +645,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var items = std.ArrayListUnmanaged(*Node){}; + var items: std.ArrayListUnmanaged(*Node) = .empty; defer items.deinit(self.state.allocator); while (try self.parseMenuItemStatement(resource, id_token, 1)) |item_node| { try items.append(self.state.allocator, item_node); @@ -679,7 +679,7 @@ pub const Parser = struct { // common resource attributes must all be contiguous and come before optional-statements const common_resource_attributes = try self.parseCommonResourceAttributes(); - var fixed_info = std.ArrayListUnmanaged(*Node){}; + var fixed_info: std.ArrayListUnmanaged(*Node) = .empty; while (try self.parseVersionStatement()) |version_statement| { try fixed_info.append(self.state.arena, version_statement); } @@ -688,7 +688,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var block_statements = std.ArrayListUnmanaged(*Node){}; + var block_statements: std.ArrayListUnmanaged(*Node) = .empty; while (try self.parseVersionBlockOrValue(id_token, 1)) |block_node| { try block_statements.append(self.state.arena, block_node); } @@ -1064,7 +1064,7 @@ pub const Parser = struct { _ = try self.parseOptionalToken(.comma); - var options = std.ArrayListUnmanaged(Token){}; + var options: std.ArrayListUnmanaged(Token) = .empty; while (true) { const option_token = try self.lookaheadToken(.normal); if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) { @@ -1099,7 +1099,7 @@ pub const Parser = struct { } try self.skipAnyCommas(); - var options = std.ArrayListUnmanaged(Token){}; + var options: std.ArrayListUnmanaged(Token) = .empty; while (true) { const option_token = try self.lookaheadToken(.normal); if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) { @@ -1114,7 +1114,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var items = std.ArrayListUnmanaged(*Node){}; + var items: std.ArrayListUnmanaged(*Node) = .empty; while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| { try items.append(self.state.arena, item_node); } @@ -1184,7 +1184,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var items = std.ArrayListUnmanaged(*Node){}; + var items: std.ArrayListUnmanaged(*Node) = .empty; while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| { try items.append(self.state.arena, item_node); } @@ -1341,7 +1341,7 @@ pub const Parser = struct { const begin_token = self.state.token; try self.check(.begin); - var children = std.ArrayListUnmanaged(*Node){}; + var children: std.ArrayListUnmanaged(*Node) = .empty; while (try self.parseVersionBlockOrValue(top_level_version_id_token, nesting_level + 1)) |value_node| { try children.append(self.state.arena, value_node); } @@ -1374,7 +1374,7 @@ pub const Parser = struct { } fn parseBlockValuesList(self: *Self, had_comma_before_first_value: bool) Error![]*Node { - var values = std.ArrayListUnmanaged(*Node){}; + var values: std.ArrayListUnmanaged(*Node) = .empty; var seen_number: bool = false; var first_string_value: ?*Node = null; while (true) { diff --git a/lib/compiler/resinator/source_mapping.zig b/lib/compiler/resinator/source_mapping.zig index 1144340252..ba396b019c 100644 --- a/lib/compiler/resinator/source_mapping.zig +++ b/lib/compiler/resinator/source_mapping.zig @@ -10,7 +10,7 @@ pub const ParseLineCommandsResult = struct { const CurrentMapping = struct { line_num: usize = 1, - filename: std.ArrayListUnmanaged(u8) = .{}, + filename: std.ArrayListUnmanaged(u8) = .empty, pending: bool = true, ignore_contents: bool = false, }; @@ -626,8 +626,8 @@ test "SourceMappings collapse" { /// Same thing as StringTable in Zig's src/Wasm.zig pub const StringTable = struct { - data: std.ArrayListUnmanaged(u8) = .{}, - map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, + data: std.ArrayListUnmanaged(u8) = .empty, + map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, pub fn deinit(self: *StringTable, allocator: Allocator) void { self.data.deinit(allocator); diff --git a/lib/compiler/std-docs.zig b/lib/compiler/std-docs.zig index 0382bbf971..9ed1acdc2c 100644 --- a/lib/compiler/std-docs.zig +++ b/lib/compiler/std-docs.zig @@ -25,7 +25,7 @@ pub fn main() !void { defer arena_instance.deinit(); const arena = arena_instance.allocator(); - var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; const gpa = general_purpose_allocator.allocator(); var argv = try std.process.argsWithAllocator(arena); @@ -265,7 +265,7 @@ fn buildWasmBinary( ) !Cache.Path { const gpa = context.gpa; - var argv: std.ArrayListUnmanaged([]const u8) = .{}; + var argv: std.ArrayListUnmanaged([]const u8) = .empty; try argv.appendSlice(arena, &.{ context.zig_exe_path, // diff --git a/lib/compiler/test_runner.zig b/lib/compiler/test_runner.zig index 83d53626c3..f88354623d 100644 --- a/lib/compiler/test_runner.zig +++ b/lib/compiler/test_runner.zig @@ -85,7 +85,7 @@ fn mainServer() !void { @panic("internal test runner memory leak"); }; - var string_bytes: std.ArrayListUnmanaged(u8) = .{}; + var string_bytes: std.ArrayListUnmanaged(u8) = .empty; defer string_bytes.deinit(testing.allocator); try string_bytes.append(testing.allocator, 0); // Reserve 0 for null. diff --git a/lib/docs/wasm/Walk.zig b/lib/docs/wasm/Walk.zig index 611830fcb8..49a5e738fc 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) = .{}; -pub var decls: std.ArrayListUnmanaged(Decl) = .{}; -pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .{}; +pub var files: std.StringArrayHashMapUnmanaged(File) = .empty; +pub var decls: std.ArrayListUnmanaged(Decl) = .empty; +pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .empty; file: File.Index, @@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) { pub const File = struct { ast: Ast, /// Maps identifiers to the declarations they point to. - ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .{}, + ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty, /// Maps field access identifiers to the containing field access node. - token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .{}, + token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty, /// Maps declarations to their global index. - node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .{}, + node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .empty, /// Maps function declarations to doctests. - doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .{}, + doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty, /// root node => its namespace scope /// struct/union/enum/opaque decl node => its namespace scope /// local var decl node => its local variable scope - scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .{}, + scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .empty, pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index { const decl_node = file.ident_decls.get(token) orelse return .none; @@ -464,8 +464,8 @@ pub const Scope = struct { const Namespace = struct { base: Scope = .{ .tag = .namespace }, parent: *Scope, - names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{}, - doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{}, + names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, + doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, decl_index: Decl.Index, }; diff --git a/lib/docs/wasm/html_render.zig b/lib/docs/wasm/html_render.zig index a5211fc77f..d9cb74f152 100644 --- a/lib/docs/wasm/html_render.zig +++ b/lib/docs/wasm/html_render.zig @@ -38,7 +38,7 @@ pub fn fileSourceHtml( const file = file_index.get(); const g = struct { - var field_access_buffer: std.ArrayListUnmanaged(u8) = .{}; + var field_access_buffer: std.ArrayListUnmanaged(u8) = .empty; }; const token_tags = ast.tokens.items(.tag); diff --git a/lib/docs/wasm/main.zig b/lib/docs/wasm/main.zig index 55882aaf7d..0ec2227512 100644 --- a/lib/docs/wasm/main.zig +++ b/lib/docs/wasm/main.zig @@ -60,8 +60,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void { }; } -var query_string: std.ArrayListUnmanaged(u8) = .{}; -var query_results: std.ArrayListUnmanaged(Decl.Index) = .{}; +var query_string: std.ArrayListUnmanaged(u8) = .empty; +var query_results: std.ArrayListUnmanaged(Decl.Index) = .empty; /// Resizes the query string to be the correct length; returns the pointer to /// the query string. @@ -93,11 +93,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void { segments: u16, }; const g = struct { - var full_path_search_text: std.ArrayListUnmanaged(u8) = .{}; - var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .{}; - var doc_search_text: std.ArrayListUnmanaged(u8) = .{}; + var full_path_search_text: std.ArrayListUnmanaged(u8) = .empty; + var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .empty; + var doc_search_text: std.ArrayListUnmanaged(u8) = .empty; /// Each element matches a corresponding query_results element. - var scores: std.ArrayListUnmanaged(Score) = .{}; + var scores: std.ArrayListUnmanaged(Score) = .empty; }; // First element stores the size of the list. @@ -255,8 +255,8 @@ const ErrorIdentifier = packed struct(u64) { } }; -var string_result: std.ArrayListUnmanaged(u8) = .{}; -var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .{}; +var string_result: std.ArrayListUnmanaged(u8) = .empty; +var error_set_result: std.StringArrayHashMapUnmanaged(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")); @@ -381,7 +381,7 @@ export fn decl_params(decl_index: Decl.Index) Slice(Ast.Node.Index) { fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { const g = struct { - var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{}; + var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty; }; g.result.clearRetainingCapacity(); const decl = decl_index.get(); @@ -403,7 +403,7 @@ fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { fn decl_params_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { const g = struct { - var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{}; + var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty; }; g.result.clearRetainingCapacity(); const decl = decl_index.get(); @@ -672,7 +672,7 @@ fn render_docs( defer parsed_doc.deinit(gpa); const g = struct { - var link_buffer: std.ArrayListUnmanaged(u8) = .{}; + var link_buffer: std.ArrayListUnmanaged(u8) = .empty; }; const Writer = std.ArrayListUnmanaged(u8).Writer; @@ -817,7 +817,7 @@ export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index { } /// Set by `set_input_string`. -var input_string: std.ArrayListUnmanaged(u8) = .{}; +var input_string: std.ArrayListUnmanaged(u8) = .empty; export fn set_input_string(len: usize) [*]u8 { input_string.resize(gpa, len) catch @panic("OOM"); @@ -839,7 +839,7 @@ export fn find_decl() Decl.Index { if (result != .none) return result; const g = struct { - var match_fqn: std.ArrayListUnmanaged(u8) = .{}; + var match_fqn: std.ArrayListUnmanaged(u8) = .empty; }; for (Walk.decls.items, 0..) |*decl, decl_index| { g.match_fqn.clearRetainingCapacity(); @@ -888,7 +888,7 @@ export fn type_fn_members(parent: Decl.Index, include_private: bool) Slice(Decl. export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) { const g = struct { - var members: std.ArrayListUnmanaged(Decl.Index) = .{}; + var members: std.ArrayListUnmanaged(Decl.Index) = .empty; }; g.members.clearRetainingCapacity(); diff --git a/lib/docs/wasm/markdown/Parser.zig b/lib/docs/wasm/markdown/Parser.zig index 024a16a2d7..32c1729684 100644 --- a/lib/docs/wasm/markdown/Parser.zig +++ b/lib/docs/wasm/markdown/Parser.zig @@ -31,11 +31,11 @@ const ExtraData = Document.ExtraData; const StringIndex = Document.StringIndex; nodes: Node.List = .{}, -extra: std.ArrayListUnmanaged(u32) = .{}, -scratch_extra: std.ArrayListUnmanaged(u32) = .{}, -string_bytes: std.ArrayListUnmanaged(u8) = .{}, -scratch_string: std.ArrayListUnmanaged(u8) = .{}, -pending_blocks: std.ArrayListUnmanaged(Block) = .{}, +extra: std.ArrayListUnmanaged(u32) = .empty, +scratch_extra: std.ArrayListUnmanaged(u32) = .empty, +string_bytes: std.ArrayListUnmanaged(u8) = .empty, +scratch_string: std.ArrayListUnmanaged(u8) = .empty, +pending_blocks: std.ArrayListUnmanaged(Block) = .empty, allocator: Allocator, const Parser = @This(); @@ -928,8 +928,8 @@ const InlineParser = struct { parent: *Parser, content: []const u8, pos: usize = 0, - pending_inlines: std.ArrayListUnmanaged(PendingInline) = .{}, - completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .{}, + pending_inlines: std.ArrayListUnmanaged(PendingInline) = .empty, + completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .empty, const PendingInline = struct { tag: Tag, diff --git a/lib/fuzzer.zig b/lib/fuzzer.zig index 3f8a991148..d8f405dccb 100644 --- a/lib/fuzzer.zig +++ b/lib/fuzzer.zig @@ -402,7 +402,7 @@ fn oom(err: anytype) noreturn { } } -var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; +var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; var fuzzer: Fuzzer = .{ .gpa = general_purpose_allocator.allocator(), diff --git a/lib/fuzzer/web/main.zig b/lib/fuzzer/web/main.zig index 9c50704e8a..c6d6810e1b 100644 --- a/lib/fuzzer/web/main.zig +++ b/lib/fuzzer/web/main.zig @@ -58,7 +58,7 @@ export fn alloc(n: usize) [*]u8 { return slice.ptr; } -var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{}; +var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty; /// Resizes the message buffer to be the correct length; returns the pointer to /// the query string. @@ -90,8 +90,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void { } /// Set by `set_input_string`. -var input_string: std.ArrayListUnmanaged(u8) = .{}; -var string_result: std.ArrayListUnmanaged(u8) = .{}; +var input_string: std.ArrayListUnmanaged(u8) = .empty; +var string_result: std.ArrayListUnmanaged(u8) = .empty; export fn set_input_string(len: usize) [*]u8 { input_string.resize(gpa, len) catch @panic("OOM"); @@ -249,7 +249,7 @@ fn coverageUpdateMessage(msg_bytes: []u8) error{OutOfMemory}!void { js.emitCoverageUpdate(); } -var entry_points: std.ArrayListUnmanaged(u32) = .{}; +var entry_points: std.ArrayListUnmanaged(u32) = .empty; fn entryPointsMessage(msg_bytes: []u8) error{OutOfMemory}!void { const header: abi.EntryPointHeader = @bitCast(msg_bytes[0..@sizeOf(abi.EntryPointHeader)].*); @@ -295,7 +295,7 @@ const SourceLocationIndex = enum(u32) { } fn toWalkFile(sli: SourceLocationIndex) ?Walk.File.Index { - var buf: std.ArrayListUnmanaged(u8) = .{}; + var buf: std.ArrayListUnmanaged(u8) = .empty; defer buf.deinit(gpa); sli.appendPath(&buf) catch @panic("OOM"); return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null); @@ -307,7 +307,7 @@ const SourceLocationIndex = enum(u32) { ) error{ OutOfMemory, SourceUnavailable }!void { const walk_file_index = sli.toWalkFile() orelse return error.SourceUnavailable; const root_node = walk_file_index.findRootDecl().get().ast_node; - var annotations: std.ArrayListUnmanaged(html_render.Annotation) = .{}; + var annotations: std.ArrayListUnmanaged(html_render.Annotation) = .empty; defer annotations.deinit(gpa); try computeSourceAnnotations(sli.ptr().file, walk_file_index, &annotations, coverage_source_locations.items); html_render.fileSourceHtml(walk_file_index, out, root_node, .{ @@ -327,7 +327,7 @@ fn computeSourceAnnotations( // Collect all the source locations from only this file into this array // first, then sort by line, col, so that we can collect annotations with // O(N) time complexity. - var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .{}; + var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .empty; defer locs.deinit(gpa); for (source_locations, 0..) |sl, sli_usize| { @@ -374,9 +374,9 @@ fn computeSourceAnnotations( var coverage = Coverage.init; /// Index of type `SourceLocationIndex`. -var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .{}; +var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .empty; /// Contains the most recent coverage update message, unmodified. -var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{}; +var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty; fn updateCoverage( directories: []const Coverage.String, @@ -425,7 +425,7 @@ export fn sourceLocationFileHtml(sli: SourceLocationIndex) String { export fn sourceLocationFileCoveredList(sli_file: SourceLocationIndex) Slice(SourceLocationIndex) { const global = struct { - var result: std.ArrayListUnmanaged(SourceLocationIndex) = .{}; + var result: std.ArrayListUnmanaged(SourceLocationIndex) = .empty; fn add(i: u32, want_file: Coverage.File.Index) void { const src_loc_index: SourceLocationIndex = @enumFromInt(i); if (src_loc_index.ptr().file == want_file) result.appendAssumeCapacity(src_loc_index); diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 109ebc8be2..236ac16c47 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -111,7 +111,7 @@ pub const ReleaseMode = enum { /// Settings that are here rather than in Build are not configurable per-package. pub const Graph = struct { arena: Allocator, - system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .{}, + system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .empty, system_package_mode: bool = false, debug_compiler_runtime_libs: bool = false, cache: Cache, @@ -119,7 +119,7 @@ pub const Graph = struct { env_map: EnvMap, global_cache_root: Cache.Directory, zig_lib_directory: Cache.Directory, - needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .{}, + needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .empty, /// Information about the native target. Computed before build() is invoked. host: ResolvedTarget, incremental: ?bool = null, diff --git a/lib/std/Build/Fuzz.zig b/lib/std/Build/Fuzz.zig index 6258f4cdda..6e837ebec2 100644 --- a/lib/std/Build/Fuzz.zig +++ b/lib/std/Build/Fuzz.zig @@ -30,7 +30,7 @@ pub fn start( defer rebuild_node.end(); var wait_group: std.Thread.WaitGroup = .{}; defer wait_group.wait(); - var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .{}; + var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .empty; defer fuzz_run_steps.deinit(gpa); for (all_steps) |step| { const run = step.cast(Step.Run) orelse continue; diff --git a/lib/std/Build/Fuzz/WebServer.zig b/lib/std/Build/Fuzz/WebServer.zig index fb78e96abb..ac4336476e 100644 --- a/lib/std/Build/Fuzz/WebServer.zig +++ b/lib/std/Build/Fuzz/WebServer.zig @@ -236,7 +236,7 @@ fn buildWasmBinary( .sub_path = "docs/wasm/html_render.zig", }; - var argv: std.ArrayListUnmanaged([]const u8) = .{}; + var argv: std.ArrayListUnmanaged([]const u8) = .empty; try argv.appendSlice(arena, &.{ ws.zig_exe_path, "build-exe", // diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index b8fb42a959..421c8fa579 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -714,7 +714,7 @@ pub fn allocPrintCmd2( opt_env: ?*const std.process.EnvMap, argv: []const []const u8, ) Allocator.Error![]u8 { - var buf: std.ArrayListUnmanaged(u8) = .{}; + var buf: std.ArrayListUnmanaged(u8) = .empty; if (opt_cwd) |cwd| try buf.writer(arena).print("cd {s} && ", .{cwd}); if (opt_env) |env| { const process_env_map = std.process.getEnvMap(arena) catch std.process.EnvMap.init(arena); diff --git a/lib/std/Build/Step/CheckObject.zig b/lib/std/Build/Step/CheckObject.zig index ce33003117..54f7bc7412 100644 --- a/lib/std/Build/Step/CheckObject.zig +++ b/lib/std/Build/Step/CheckObject.zig @@ -713,12 +713,12 @@ const MachODumper = struct { gpa: Allocator, data: []const u8, header: macho.mach_header_64, - segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, - sections: std.ArrayListUnmanaged(macho.section_64) = .{}, - symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, - strtab: std.ArrayListUnmanaged(u8) = .{}, - indsymtab: std.ArrayListUnmanaged(u32) = .{}, - imports: std.ArrayListUnmanaged([]const u8) = .{}, + segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, + sections: std.ArrayListUnmanaged(macho.section_64) = .empty, + symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, + strtab: std.ArrayListUnmanaged(u8) = .empty, + indsymtab: std.ArrayListUnmanaged(u32) = .empty, + imports: std.ArrayListUnmanaged([]const u8) = .empty, fn parse(ctx: *ObjectContext) !void { var it = ctx.getLoadCommandIterator(); @@ -1797,9 +1797,9 @@ const ElfDumper = struct { const ArchiveContext = struct { gpa: Allocator, data: []const u8, - symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .{}, + symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .empty, strtab: []const u8, - objects: std.ArrayListUnmanaged(struct { name: []const u8, off: usize, len: usize }) = .{}, + objects: std.ArrayListUnmanaged(struct { name: []const u8, off: usize, len: usize }) = .empty, fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void { var stream = std.io.fixedBufferStream(raw); diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index 922d64c728..0f0b5d3201 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -1070,8 +1070,8 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { // Stores system libraries that have already been seen for at least one // module, along with any arguments that need to be passed to the // compiler for each module individually. - var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .{}; - var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .{}; + var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .empty; + var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .empty; var prev_has_cflags = false; var prev_has_rcflags = false; diff --git a/lib/std/Build/Step/Fmt.zig b/lib/std/Build/Step/Fmt.zig index 576aeb1d21..a364dfa6f4 100644 --- a/lib/std/Build/Step/Fmt.zig +++ b/lib/std/Build/Step/Fmt.zig @@ -48,7 +48,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { const arena = b.allocator; const fmt: *Fmt = @fieldParentPtr("step", step); - var argv: std.ArrayListUnmanaged([]const u8) = .{}; + var argv: std.ArrayListUnmanaged([]const u8) = .empty; try argv.ensureUnusedCapacity(arena, 2 + 1 + fmt.paths.len + 2 * fmt.exclude_paths.len); argv.appendAssumeCapacity(b.graph.zig_exe); diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig index e37b97ddb3..c35ba00b79 100644 --- a/lib/std/Build/Step/Run.zig +++ b/lib/std/Build/Step/Run.zig @@ -856,7 +856,7 @@ pub fn rerunInFuzzMode( const step = &run.step; const b = step.owner; const arena = b.allocator; - var argv_list: std.ArrayListUnmanaged([]const u8) = .{}; + var argv_list: std.ArrayListUnmanaged([]const u8) = .empty; for (run.argv.items) |arg| { switch (arg) { .bytes => |bytes| { diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig index 1b96be472a..bf411b3798 100644 --- a/lib/std/array_hash_map.zig +++ b/lib/std/array_hash_map.zig @@ -130,7 +130,7 @@ pub fn ArrayHashMap( } pub fn initContext(allocator: Allocator, ctx: Context) Self { return .{ - .unmanaged = .{}, + .unmanaged = .empty, .allocator = allocator, .ctx = ctx, }; @@ -429,7 +429,7 @@ pub fn ArrayHashMap( pub fn move(self: *Self) Self { self.unmanaged.pointer_stability.assertUnlocked(); const result = self.*; - self.unmanaged = .{}; + self.unmanaged = .empty; return result; } @@ -1290,7 +1290,7 @@ pub fn ArrayHashMapUnmanaged( pub fn move(self: *Self) Self { self.pointer_stability.assertUnlocked(); const result = self.*; - self.* = .{}; + self.* = .empty; return result; } diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 24098a01f6..ac1b144690 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -710,7 +710,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ const old_memory = self.allocatedSlice(); if (allocator.resize(old_memory, self.items.len)) { const result = self.items; - self.* = .{}; + self.* = .empty; return result; } @@ -1267,7 +1267,7 @@ test "init" { } { - const list = ArrayListUnmanaged(i32){}; + const list: ArrayListUnmanaged(i32) = .empty; try testing.expect(list.items.len == 0); try testing.expect(list.capacity == 0); @@ -1312,7 +1312,7 @@ test "clone" { try testing.expectEqual(@as(i32, 5), cloned.items[2]); } { - var array = ArrayListUnmanaged(i32){}; + var array: ArrayListUnmanaged(i32) = .empty; try array.append(a, -1); try array.append(a, 3); try array.append(a, 5); @@ -1384,7 +1384,7 @@ test "basic" { try testing.expect(list.pop() == 33); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); { @@ -1448,7 +1448,7 @@ test "appendNTimes" { } } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendNTimes(a, 2, 10); @@ -1467,7 +1467,7 @@ test "appendNTimes with failing allocator" { try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10)); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10)); } @@ -1502,7 +1502,7 @@ test "orderedRemove" { try testing.expectEqual(@as(usize, 4), list.items.len); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.append(a, 1); @@ -1537,7 +1537,7 @@ test "orderedRemove" { } { // remove last item - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.append(a, 1); try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); @@ -1574,7 +1574,7 @@ test "swapRemove" { try testing.expect(list.items.len == 4); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.append(a, 1); @@ -1617,7 +1617,7 @@ test "insert" { try testing.expect(list.items[3] == 3); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.insert(a, 0, 1); @@ -1655,7 +1655,7 @@ test "insertSlice" { try testing.expect(list.items[0] == 1); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.append(a, 1); @@ -1789,7 +1789,7 @@ test "ArrayListUnmanaged.replaceRange" { const a = testing.allocator; { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1798,7 +1798,7 @@ test "ArrayListUnmanaged.replaceRange" { try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1811,7 +1811,7 @@ test "ArrayListUnmanaged.replaceRange" { ); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1820,7 +1820,7 @@ test "ArrayListUnmanaged.replaceRange" { try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1829,7 +1829,7 @@ test "ArrayListUnmanaged.replaceRange" { try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1843,7 +1843,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { const a = testing.allocator; { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1852,7 +1852,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1865,7 +1865,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { ); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1874,7 +1874,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1883,7 +1883,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); @@ -1906,15 +1906,15 @@ const ItemUnmanaged = struct { test "ArrayList(T) of struct T" { const a = std.testing.allocator; { - var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(a) }; + var root = Item{ .integer = 1, .sub_items = .init(a) }; defer root.sub_items.deinit(); - try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(a) }); + try root.sub_items.append(Item{ .integer = 42, .sub_items = .init(a) }); try testing.expect(root.sub_items.items[0].integer == 42); } { - var root = ItemUnmanaged{ .integer = 1, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} }; + var root = ItemUnmanaged{ .integer = 1, .sub_items = .empty }; defer root.sub_items.deinit(a); - try root.sub_items.append(a, ItemUnmanaged{ .integer = 42, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} }); + try root.sub_items.append(a, ItemUnmanaged{ .integer = 42, .sub_items = .empty }); try testing.expect(root.sub_items.items[0].integer == 42); } } @@ -1950,7 +1950,7 @@ test "ArrayListUnmanaged(u8) implements writer" { const a = testing.allocator; { - var buffer: ArrayListUnmanaged(u8) = .{}; + var buffer: ArrayListUnmanaged(u8) = .empty; defer buffer.deinit(a); const x: i32 = 42; @@ -1960,7 +1960,7 @@ test "ArrayListUnmanaged(u8) implements writer" { try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); } { - var list: ArrayListAlignedUnmanaged(u8, 2) = .{}; + var list: ArrayListAlignedUnmanaged(u8, 2) = .empty; defer list.deinit(a); const writer = list.writer(a); @@ -1989,7 +1989,7 @@ test "shrink still sets length when resizing is disabled" { try testing.expect(list.items.len == 1); } { - var list = ArrayListUnmanaged(i32){}; + var list: ArrayListUnmanaged(i32) = .empty; defer list.deinit(a); try list.append(a, 1); @@ -2026,7 +2026,7 @@ test "addManyAsArray" { try testing.expectEqualSlices(u8, list.items, "aoeuasdf"); } { - var list = ArrayListUnmanaged(u8){}; + var list: ArrayListUnmanaged(u8) = .empty; defer list.deinit(a); (try list.addManyAsArray(a, 4)).* = "aoeu".*; @@ -2056,7 +2056,7 @@ test "growing memory preserves contents" { try testing.expectEqualSlices(u8, list.items, "abcdijklefgh"); } { - var list = ArrayListUnmanaged(u8){}; + var list: ArrayListUnmanaged(u8) = .empty; defer list.deinit(a); (try list.addManyAsArray(a, 4)).* = "abcd".*; @@ -2132,7 +2132,7 @@ test "toOwnedSliceSentinel" { try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0)); } { - var list = ArrayListUnmanaged(u8){}; + var list: ArrayListUnmanaged(u8) = .empty; defer list.deinit(a); try list.appendSlice(a, "foobar"); @@ -2156,7 +2156,7 @@ test "accepts unaligned slices" { try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 }); } { - var list = std.ArrayListAlignedUnmanaged(u8, 8){}; + var list: std.ArrayListAlignedUnmanaged(u8, 8) = .empty; defer list.deinit(a); try list.appendSlice(a, &.{ 0, 1, 2, 3 }); diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig index 92a6d43ac6..627cd4172b 100644 --- a/lib/std/crypto/Certificate/Bundle.zig +++ b/lib/std/crypto/Certificate/Bundle.zig @@ -6,8 +6,8 @@ //! certificate within `bytes`. /// The key is the contents slice of the subject. -map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .{}, -bytes: std.ArrayListUnmanaged(u8) = .{}, +map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .empty, +bytes: std.ArrayListUnmanaged(u8) = .empty, pub const VerifyError = Certificate.Parsed.VerifyError || error{ CertificateIssuerNotFound, diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig index 1bc47a3e38..d36e4f961d 100644 --- a/lib/std/debug/Dwarf.zig +++ b/lib/std/debug/Dwarf.zig @@ -42,20 +42,20 @@ sections: SectionArray = null_section_array, is_macho: bool, /// Filled later by the initializer -abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .{}, +abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .empty, /// Filled later by the initializer -compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .{}, +compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .empty, /// Filled later by the initializer -func_list: std.ArrayListUnmanaged(Func) = .{}, +func_list: std.ArrayListUnmanaged(Func) = .empty, eh_frame_hdr: ?ExceptionFrameHeader = null, /// These lookup tables are only used if `eh_frame_hdr` is null -cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .{}, +cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty, /// Sorted by start_pc -fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .{}, +fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .empty, /// Populated by `populateRanges`. -ranges: std.ArrayListUnmanaged(Range) = .{}, +ranges: std.ArrayListUnmanaged(Range) = .empty, pub const Range = struct { start: u64, @@ -1464,9 +1464,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) ! const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1); - var directories: std.ArrayListUnmanaged(FileEntry) = .{}; + var directories: std.ArrayListUnmanaged(FileEntry) = .empty; defer directories.deinit(gpa); - var file_entries: std.ArrayListUnmanaged(FileEntry) = .{}; + var file_entries: std.ArrayListUnmanaged(FileEntry) = .empty; defer file_entries.deinit(gpa); if (version < 5) { diff --git a/lib/std/debug/Dwarf/expression.zig b/lib/std/debug/Dwarf/expression.zig index f71a4e02c1..38bce2614c 100644 --- a/lib/std/debug/Dwarf/expression.zig +++ b/lib/std/debug/Dwarf/expression.zig @@ -153,7 +153,7 @@ pub fn StackMachine(comptime options: Options) type { } }; - stack: std.ArrayListUnmanaged(Value) = .{}, + stack: std.ArrayListUnmanaged(Value) = .empty, pub fn reset(self: *Self) void { self.stack.clearRetainingCapacity(); diff --git a/lib/std/debug/SelfInfo.zig b/lib/std/debug/SelfInfo.zig index 5e7aefef38..76c0505e96 100644 --- a/lib/std/debug/SelfInfo.zig +++ b/lib/std/debug/SelfInfo.zig @@ -1933,8 +1933,8 @@ pub const VirtualMachine = struct { len: u8 = 0, }; - columns: std.ArrayListUnmanaged(Column) = .{}, - stack: std.ArrayListUnmanaged(ColumnRange) = .{}, + columns: std.ArrayListUnmanaged(Column) = .empty, + stack: std.ArrayListUnmanaged(ColumnRange) = .empty, current_row: Row = .{}, /// The result of executing the CIE's initial_instructions diff --git a/lib/std/fs/Dir.zig b/lib/std/fs/Dir.zig index d4ea8a0109..2e84d1097f 100644 --- a/lib/std/fs/Dir.zig +++ b/lib/std/fs/Dir.zig @@ -750,7 +750,7 @@ pub const Walker = struct { /// /// `self` will not be closed after walking it. pub fn walk(self: Dir, allocator: Allocator) Allocator.Error!Walker { - var stack: std.ArrayListUnmanaged(Walker.StackItem) = .{}; + var stack: std.ArrayListUnmanaged(Walker.StackItem) = .empty; try stack.append(allocator, .{ .iter = self.iterate(), diff --git a/lib/std/fs/wasi.zig b/lib/std/fs/wasi.zig index 040dd4ca3e..5d729c9da1 100644 --- a/lib/std/fs/wasi.zig +++ b/lib/std/fs/wasi.zig @@ -24,7 +24,7 @@ pub const Preopens = struct { }; pub fn preopensAlloc(gpa: Allocator) Allocator.Error!Preopens { - var names: std.ArrayListUnmanaged([]const u8) = .{}; + var names: std.ArrayListUnmanaged([]const u8) = .empty; defer names.deinit(gpa); try names.ensureUnusedCapacity(gpa, 3); diff --git a/lib/std/hash/benchmark.zig b/lib/std/hash/benchmark.zig index 0798e26d6f..0a73be39ce 100644 --- a/lib/std/hash/benchmark.zig +++ b/lib/std/hash/benchmark.zig @@ -410,7 +410,7 @@ pub fn main() !void { } } - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); const allocator = gpa.allocator(); diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig index 54b85e4b3d..9c436320b7 100644 --- a/lib/std/hash_map.zig +++ b/lib/std/hash_map.zig @@ -401,7 +401,7 @@ pub fn HashMap( @compileError("Context must be specified! Call initContext(allocator, ctx) instead."); } return .{ - .unmanaged = .{}, + .unmanaged = .empty, .allocator = allocator, .ctx = undefined, // ctx is zero-sized so this is safe. }; @@ -410,7 +410,7 @@ pub fn HashMap( /// Create a managed hash map with a context pub fn initContext(allocator: Allocator, ctx: Context) Self { return .{ - .unmanaged = .{}, + .unmanaged = .empty, .allocator = allocator, .ctx = ctx, }; @@ -691,7 +691,7 @@ pub fn HashMap( pub fn move(self: *Self) Self { self.unmanaged.pointer_stability.assertUnlocked(); const result = self.*; - self.unmanaged = .{}; + self.unmanaged = .empty; return result; } @@ -1543,7 +1543,7 @@ pub fn HashMapUnmanaged( return self.cloneContext(allocator, @as(Context, undefined)); } pub fn cloneContext(self: Self, allocator: Allocator, new_ctx: anytype) Allocator.Error!HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) { - var other = HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage){}; + var other: HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) = .empty; if (self.size == 0) return other; @@ -1572,7 +1572,7 @@ pub fn HashMapUnmanaged( pub fn move(self: *Self) Self { self.pointer_stability.assertUnlocked(); const result = self.*; - self.* = .{}; + self.* = .empty; return result; } @@ -2360,7 +2360,7 @@ test "removeByPtr 0 sized key" { } test "repeat fetchRemove" { - var map = AutoHashMapUnmanaged(u64, void){}; + var map: AutoHashMapUnmanaged(u64, void) = .empty; defer map.deinit(testing.allocator); try map.ensureTotalCapacity(testing.allocator, 4); @@ -2384,7 +2384,7 @@ test "repeat fetchRemove" { } test "getOrPut allocation failure" { - var map: std.StringHashMapUnmanaged(void) = .{}; + var map: std.StringHashMapUnmanaged(void) = .empty; try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello")); } diff --git a/lib/std/json/hashmap.zig b/lib/std/json/hashmap.zig index b40fb5e4c7..be4e9bd2dd 100644 --- a/lib/std/json/hashmap.zig +++ b/lib/std/json/hashmap.zig @@ -12,14 +12,14 @@ const Value = @import("dynamic.zig").Value; /// instead of comptime-known struct field names. pub fn ArrayHashMap(comptime T: type) type { return struct { - map: std.StringArrayHashMapUnmanaged(T) = .{}, + map: std.StringArrayHashMapUnmanaged(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){}; + var map: std.StringArrayHashMapUnmanaged(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){}; + var map: std.StringArrayHashMapUnmanaged(T) = .empty; errdefer map.deinit(allocator); var it = source.object.iterator(); diff --git a/lib/std/process/Child.zig b/lib/std/process/Child.zig index 2002bad20e..3a54ede2ad 100644 --- a/lib/std/process/Child.zig +++ b/lib/std/process/Child.zig @@ -907,12 +907,12 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void { var cmd_line_cache = WindowsCommandLineCache.init(self.allocator, self.argv); defer cmd_line_cache.deinit(); - var app_buf = std.ArrayListUnmanaged(u16){}; + var app_buf: std.ArrayListUnmanaged(u16) = .empty; defer app_buf.deinit(self.allocator); try app_buf.appendSlice(self.allocator, app_name_w); - var dir_buf = std.ArrayListUnmanaged(u16){}; + var dir_buf: std.ArrayListUnmanaged(u16) = .empty; defer dir_buf.deinit(self.allocator); if (cwd_path_w.len > 0) { diff --git a/lib/std/tar.zig b/lib/std/tar.zig index 491d11af2a..f15a5e8c8a 100644 --- a/lib/std/tar.zig +++ b/lib/std/tar.zig @@ -27,7 +27,7 @@ pub const writer = @import("tar/writer.zig").writer; /// the errors in diagnostics to know whether the operation succeeded or failed. pub const Diagnostics = struct { allocator: std.mem.Allocator, - errors: std.ArrayListUnmanaged(Error) = .{}, + errors: std.ArrayListUnmanaged(Error) = .empty, entries: usize = 0, root_dir: []const u8 = "", diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 2cc38749eb..91caa7d922 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -11,10 +11,10 @@ pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAll /// This should only be used in temporary test programs. pub const allocator = allocator_instance.allocator(); -pub var allocator_instance = b: { +pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{}) = b: { if (!builtin.is_test) @compileError("Cannot use testing allocator outside of test block"); - break :b std.heap.GeneralPurposeAllocator(.{}){}; + break :b .init; }; pub const failing_allocator = failing_allocator_instance.allocator(); diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index 675fe095a2..79ab85f6db 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -22,8 +22,8 @@ tree: *const Ast, /// sub-expressions. See `AstRlAnnotate` for details. nodes_need_rl: *const AstRlAnnotate.RlNeededSet, instructions: std.MultiArrayList(Zir.Inst) = .{}, -extra: ArrayListUnmanaged(u32) = .{}, -string_bytes: ArrayListUnmanaged(u8) = .{}, +extra: ArrayListUnmanaged(u32) = .empty, +string_bytes: ArrayListUnmanaged(u8) = .empty, /// Tracks the current byte offset within the source file. /// Used to populate line deltas in the ZIR. AstGen maintains /// this "cursor" throughout the entire AST lowering process in order @@ -39,8 +39,8 @@ source_column: u32 = 0, /// Used for temporary allocations; freed after AstGen is complete. /// The resulting ZIR code has no references to anything in this arena. arena: Allocator, -string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, -compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .{}, +string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, +compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .empty, /// The topmost block of the current function. fn_block: ?*GenZir = null, fn_var_args: bool = false, @@ -52,9 +52,9 @@ within_fn: bool = false, fn_ret_ty: Zir.Inst.Ref = .none, /// Maps string table indexes to the first `@import` ZIR instruction /// that uses this string as the operand. -imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{}, +imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty, /// Used for temporary storage when building payloads. -scratch: std.ArrayListUnmanaged(u32) = .{}, +scratch: std.ArrayListUnmanaged(u32) = .empty, /// Whenever a `ref` instruction is needed, it is created and saved in this /// table instead of being immediately appended to the current block body. /// Then, when the instruction is being added to the parent block (typically from @@ -65,7 +65,7 @@ scratch: std.ArrayListUnmanaged(u32) = .{}, /// 2. `ref` instructions will dominate their uses. This is a required property /// of ZIR. /// The key is the ref operand; the value is the ref instruction. -ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{}, +ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty, /// Any information which should trigger invalidation of incremental compilation /// data should be used to update this hasher. The result is the final source /// hash of the enclosing declaration/etc. @@ -159,7 +159,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { var top_scope: Scope.Top = .{}; - var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; var gen_scope: GenZir = .{ .is_comptime = true, .parent = &top_scope.base, @@ -5854,7 +5854,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len); var fields_len: usize = 0; { - var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{}; + var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty; defer idents.deinit(gpa); const error_token = main_tokens[node]; @@ -11259,7 +11259,7 @@ fn identifierTokenString(astgen: *AstGen, token: Ast.TokenIndex) InnerError![]co if (!mem.startsWith(u8, ident_name, "@")) { return ident_name; } - var buf: ArrayListUnmanaged(u8) = .{}; + var buf: ArrayListUnmanaged(u8) = .empty; defer buf.deinit(astgen.gpa); try astgen.parseStrLit(token, &buf, ident_name, 1); if (mem.indexOfScalar(u8, buf.items, 0) != null) { @@ -11881,7 +11881,7 @@ const Scope = struct { parent: *Scope, /// Maps string table index to the source location of declaration, /// for the purposes of reporting name shadowing compile errors. - decls: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.Node.Index) = .{}, + decls: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.Node.Index) = .empty, node: Ast.Node.Index, inst: Zir.Inst.Index, maybe_generic: bool, @@ -11891,7 +11891,7 @@ const Scope = struct { declaring_gz: ?*GenZir, /// Set of captures used by this namespace. - captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .{}, + captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .empty, fn deinit(self: *Namespace, gpa: Allocator) void { self.decls.deinit(gpa); @@ -13607,9 +13607,9 @@ fn scanContainer( var sfba_state = std.heap.stackFallback(512, astgen.gpa); const sfba = sfba_state.get(); - var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{}; - var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{}; - var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{}; + var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; + var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; + var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; defer { names.deinit(sfba); test_names.deinit(sfba); @@ -13796,7 +13796,7 @@ fn scanContainer( for (names.keys(), names.values()) |name, first| { if (first.next == null) continue; - var notes: std.ArrayListUnmanaged(u32) = .{}; + var notes: std.ArrayListUnmanaged(u32) = .empty; var prev: NameEntry = first; while (prev.next) |cur| : (prev = cur.*) { try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate name here", .{})); @@ -13808,7 +13808,7 @@ fn scanContainer( for (test_names.keys(), test_names.values()) |name, first| { if (first.next == null) continue; - var notes: std.ArrayListUnmanaged(u32) = .{}; + var notes: std.ArrayListUnmanaged(u32) = .empty; var prev: NameEntry = first; while (prev.next) |cur| : (prev = cur.*) { try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate test here", .{})); @@ -13820,7 +13820,7 @@ fn scanContainer( for (decltest_names.keys(), decltest_names.values()) |name, first| { if (first.next == null) continue; - var notes: std.ArrayListUnmanaged(u32) = .{}; + var notes: std.ArrayListUnmanaged(u32) = .empty; var prev: NameEntry = first; while (prev.next) |cur| : (prev = cur.*) { try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate decltest here", .{})); @@ -13949,10 +13949,10 @@ fn lowerAstErrors(astgen: *AstGen) !void { const gpa = astgen.gpa; const parse_err = tree.errors[0]; - var msg: std.ArrayListUnmanaged(u8) = .{}; + var msg: std.ArrayListUnmanaged(u8) = .empty; defer msg.deinit(gpa); - var notes: std.ArrayListUnmanaged(u32) = .{}; + var notes: std.ArrayListUnmanaged(u32) = .empty; defer notes.deinit(gpa); for (tree.errors[1..]) |note| { diff --git a/lib/std/zig/ErrorBundle.zig b/lib/std/zig/ErrorBundle.zig index 63e0748d8d..3f3c7ff9e3 100644 --- a/lib/std/zig/ErrorBundle.zig +++ b/lib/std/zig/ErrorBundle.zig @@ -571,7 +571,7 @@ pub const Wip = struct { if (index == .none) return .none; const other_sl = other.getSourceLocation(index); - var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .{}; + var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .empty; defer ref_traces.deinit(wip.gpa); if (other_sl.reference_trace_len > 0) { diff --git a/lib/std/zig/WindowsSdk.zig b/lib/std/zig/WindowsSdk.zig index 1e1f0f1629..8fe37affc0 100644 --- a/lib/std/zig/WindowsSdk.zig +++ b/lib/std/zig/WindowsSdk.zig @@ -751,7 +751,7 @@ const MsvcLibDir = struct { defer instances_dir.close(); var state_subpath_buf: [std.fs.max_name_bytes + 32]u8 = undefined; - var latest_version_lib_dir = std.ArrayListUnmanaged(u8){}; + var latest_version_lib_dir: std.ArrayListUnmanaged(u8) = .empty; errdefer latest_version_lib_dir.deinit(allocator); var latest_version: u64 = 0; diff --git a/lib/std/zig/Zir.zig b/lib/std/zig/Zir.zig index a918bb769c..8f86dabb5d 100644 --- a/lib/std/zig/Zir.zig +++ b/lib/std/zig/Zir.zig @@ -3711,7 +3711,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In // `defer` instructions duplicate the same body arbitrarily many times, but we only want to traverse // their contents once per defer. So, we store the extra index of the body here to deduplicate. - var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{}; + var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty; defer found_defers.deinit(gpa); try zir.findDeclsBody(gpa, list, &found_defers, bodies.value_body); @@ -3725,7 +3725,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In pub fn findDeclsRoot(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.Index)) !void { list.clearRetainingCapacity(); - var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{}; + var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty; defer found_defers.deinit(gpa); try zir.findDeclsInner(gpa, list, &found_defers, .main_struct_inst); diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index c0391b4faf..c78a8cb07d 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -17,21 +17,21 @@ const Ais = AutoIndentingStream(std.ArrayList(u8).Writer); pub const Fixups = struct { /// The key is the mut token (`var`/`const`) of the variable declaration /// that should have a `_ = foo;` inserted afterwards. - unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .{}, + unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .empty, /// The functions in this unordered set of AST fn decl nodes will render /// with a function body of `@trap()` instead, with all parameters /// discarded. - gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{}, + gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty, /// These global declarations will be omitted. - omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{}, + omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty, /// These expressions will be replaced with the string value. - replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .{}, + replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .empty, /// The string value will be inserted directly after the node. - append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .{}, + append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .empty, /// These nodes will be replaced with a different node. - replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .{}, + 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) = .{}, + rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .empty, /// All `@import` builtin calls which refer to a file path will be prefixed /// with this path. diff --git a/lib/std/zig/system/NativePaths.zig b/lib/std/zig/system/NativePaths.zig index 2a50e27b0c..3c96134556 100644 --- a/lib/std/zig/system/NativePaths.zig +++ b/lib/std/zig/system/NativePaths.zig @@ -7,11 +7,11 @@ const mem = std.mem; const NativePaths = @This(); arena: Allocator, -include_dirs: std.ArrayListUnmanaged([]const u8) = .{}, -lib_dirs: std.ArrayListUnmanaged([]const u8) = .{}, -framework_dirs: std.ArrayListUnmanaged([]const u8) = .{}, -rpaths: std.ArrayListUnmanaged([]const u8) = .{}, -warnings: std.ArrayListUnmanaged([]const u8) = .{}, +include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, +lib_dirs: std.ArrayListUnmanaged([]const u8) = .empty, +framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty, +rpaths: std.ArrayListUnmanaged([]const u8) = .empty, +warnings: std.ArrayListUnmanaged([]const u8) = .empty, pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { var self: NativePaths = .{ .arena = arena }; diff --git a/src/Compilation.zig b/src/Compilation.zig index bd93b2061b..0c1bbda65d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8, /// Corresponds to `-u ` for ELF/MachO and `/include:` for COFF/PE. force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), -c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .{}, +c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty, win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct { pub fn keys(_: @This()) [0]void { return .{}; @@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa pub fn deinit(_: @This(), _: Allocator) void {} } = .{}, -link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{}, +link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .empty, link_errors_mutex: std.Thread.Mutex = .{}, link_error_flags: link.File.ErrorFlags = .{}, -lld_errors: std.ArrayListUnmanaged(LldError) = .{}, +lld_errors: std.ArrayListUnmanaged(LldError) = .empty, work_queues: [ len: { @@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic), /// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator. /// This data is accessed by multiple threads and is protected by `mutex`. -failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .{}, +failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .empty, /// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator. /// This data is accessed by multiple threads and is protected by `mutex`. @@ -166,7 +166,7 @@ failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHash } = .{}, /// Miscellaneous things that can fail. -misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .{}, +misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .empty, /// When this is `true` it means invoking clang as a sub-process is expected to inherit /// stdin, stdout, stderr, and if it returns non success, to forward the exit code. @@ -248,7 +248,7 @@ wasi_emulated_libs: []const wasi_libc.CRTFile, /// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source, /// The set of needed CRT (C runtime) files differs depending on the target and compilation settings. /// The key is the basename, and the value is the absolute path to the completed build artifact. -crt_files: std.StringHashMapUnmanaged(CRTFile) = .{}, +crt_files: std.StringHashMapUnmanaged(CRTFile) = .empty, /// How many lines of reference trace should be included per compile error. /// Null means only show snippet on first error. @@ -527,8 +527,8 @@ pub const CObject = struct { } pub const Bundle = struct { - file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}, - category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}, + file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, + category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, diags: []Diag = &.{}, pub fn destroy(bundle: *Bundle, gpa: Allocator) void { @@ -561,8 +561,8 @@ pub const CObject = struct { category: u32 = 0, msg: []const u8 = &.{}, src_loc: SrcLoc = .{}, - src_ranges: std.ArrayListUnmanaged(SrcRange) = .{}, - sub_diags: std.ArrayListUnmanaged(Diag) = .{}, + src_ranges: std.ArrayListUnmanaged(SrcRange) = .empty, + sub_diags: std.ArrayListUnmanaged(Diag) = .empty, fn deinit(wip_diag: *@This(), allocator: Allocator) void { allocator.free(wip_diag.msg); @@ -580,19 +580,19 @@ pub const CObject = struct { var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() }); defer bc.deinit(); - var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}; + var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; errdefer { for (file_names.values()) |file_name| gpa.free(file_name); file_names.deinit(gpa); } - var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}; + var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; errdefer { for (category_names.values()) |category_name| gpa.free(category_name); category_names.deinit(gpa); } - var stack: std.ArrayListUnmanaged(WipDiag) = .{}; + var stack: std.ArrayListUnmanaged(WipDiag) = .empty; defer { for (stack.items) |*wip_diag| wip_diag.deinit(gpa); stack.deinit(gpa); @@ -1067,7 +1067,7 @@ pub const CreateOptions = struct { cache_mode: CacheMode = .incremental, lib_dirs: []const []const u8 = &[0][]const u8{}, rpath_list: []const []const u8 = &[0][]const u8{}, - symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{}, + symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty, c_source_files: []const CSourceFile = &.{}, rc_source_files: []const RcSourceFile = &.{}, manifest_file: ?[]const u8 = null, @@ -1155,7 +1155,7 @@ pub const CreateOptions = struct { skip_linker_dependencies: bool = false, hash_style: link.File.Elf.HashStyle = .both, entry: Entry = .default, - force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}, + force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty, stack_size: ?u64 = null, image_base: ?u64 = null, version: ?std.SemanticVersion = null, @@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash( main_mod: *Package.Module, hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, ) (error{OutOfMemory} || std.process.GetCwdError)!void { - var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{}; + var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty; defer seen_table.deinit(gpa); // root_mod and main_mod may be the same pointer. In fact they usually are. @@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg( const file_path = try err_src_loc.file_scope.fullPath(gpa); defer gpa.free(file_path); - var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .{}; + var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .empty; defer ref_traces.deinit(gpa); if (module_err_msg.reference_trace_root.unwrap()) |rt_root| { @@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg( all_references.* = try mod.resolveReferences(); } - var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .{}; + var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .empty; defer seen.deinit(gpa); const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len; @@ -3439,7 +3439,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) = .{}; + var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty; defer notes.deinit(gpa); for (module_err_msg.notes) |module_note| { @@ -3544,7 +3544,7 @@ fn performAllTheWorkInner( comp.job_queued_update_builtin_zig = false; if (comp.zcu == null) break :b; // TODO put all the modules in a flat array to make them easy to iterate. - var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{}; + var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty; defer seen.deinit(comp.gpa); try seen.put(comp.gpa, comp.root_mod, {}); var i: usize = 0; @@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { }; defer tar_file.close(); - var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .{}; + var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .empty; defer seen_table.deinit(comp.gpa); try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name); @@ -5221,7 +5221,7 @@ fn spawnZigRc( argv: []const []const u8, child_progress_node: std.Progress.Node, ) !void { - var node_name: std.ArrayListUnmanaged(u8) = .{}; + var node_name: std.ArrayListUnmanaged(u8) = .empty; defer node_name.deinit(arena); var child = std.process.Child.init(argv, arena); @@ -5540,7 +5540,7 @@ pub fn addCCArgs( } { - var san_arg: std.ArrayListUnmanaged(u8) = .{}; + var san_arg: std.ArrayListUnmanaged(u8) = .empty; const prefix = "-fsanitize="; if (mod.sanitize_c) { if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); diff --git a/src/InternPool.zig b/src/InternPool.zig index fbfd29369f..8160265e65 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -23,36 +23,36 @@ tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_th /// * For a `func`, this is the source of the full function signature. /// These are also invalidated if tracking fails for this instruction. /// Value is index into `dep_entries` of the first dependency on this hash. -src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{}, +src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .empty, /// Dependencies on the value of a Nav. /// Value is index into `dep_entries` of the first dependency on this Nav value. -nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index) = .{}, +nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index) = .empty, /// Dependencies on an interned value, either: /// * a runtime function (invalidated when its IES changes) /// * a container type requiring resolution (invalidated when the type must be recreated at a new index) /// Value is index into `dep_entries` of the first dependency on this interned value. -interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index) = .{}, +interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index) = .empty, /// Dependencies on the full set of names in a ZIR namespace. /// Key refers to a `struct_decl`, `union_decl`, etc. /// Value is index into `dep_entries` of the first dependency on this namespace. -namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{}, +namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .empty, /// Dependencies on the (non-)existence of some name in a namespace. /// Value is index into `dep_entries` of the first dependency on this name. -namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index) = .{}, +namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index) = .empty, /// Given a `Depender`, points to an entry in `dep_entries` whose `depender` /// matches. The `next_dependee` field can be used to iterate all such entries /// and remove them from the corresponding lists. -first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index) = .{}, +first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index) = .empty, /// Stores dependency information. The hashmaps declared above are used to look /// up entries in this list as required. This is not stored in `extra` so that /// we can use `free_dep_entries` to track free indices, since dependencies are /// removed frequently. -dep_entries: std.ArrayListUnmanaged(DepEntry) = .{}, +dep_entries: std.ArrayListUnmanaged(DepEntry) = .empty, /// Stores unused indices in `dep_entries` which can be reused without a full /// garbage collection pass. -free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index) = .{}, +free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index) = .empty, /// Whether a multi-threaded intern pool is useful. /// Currently `false` until the intern pool is actually accessed @@ -10791,7 +10791,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) var bw = std.io.bufferedWriter(std.io.getStdErr().writer()); const w = bw.writer(); - var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .{}; + var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .empty; for (ip.locals, 0..) |*local, tid| { const items = local.shared.items.view().slice(); const extra_list = local.shared.extra; diff --git a/src/Liveness.zig b/src/Liveness.zig index d90af6462a..abada07492 100644 --- a/src/Liveness.zig +++ b/src/Liveness.zig @@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type { /// body and which we are currently within. Also includes `loop`s which are the target /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a /// `switch_dispatch` instruction. - breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, + breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, /// The set of operands for which we have seen at least one usage but not their birth. - live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, + live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, fn deinit(self: *@This(), gpa: Allocator) void { self.breaks.deinit(gpa); @@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type { .main_analysis => struct { /// Every `block` and `loop` currently under analysis. - block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .{}, + block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .empty, /// The set of instructions currently alive in the current control /// flow branch. - live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, + live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, /// The extra data initialized by the `loop_analysis` pass for this pass to consume. /// Owned by this struct during this pass. - old_extra: std.ArrayListUnmanaged(u32) = .{}, + old_extra: std.ArrayListUnmanaged(u32) = .empty, const BlockScope = struct { /// If this is a `block`, these instructions are alive upon a `br` to this block. @@ -1710,10 +1710,10 @@ fn analyzeInstCondBr( // Operands which are alive in one branch but not the other need to die at the start of // the peer branch. - var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{}; + var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty; defer then_mirrored_deaths.deinit(gpa); - var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{}; + var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty; defer else_mirrored_deaths.deinit(gpa); // Note: this invalidates `else_live`, but expands `then_live` to be their union @@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr( switch (pass) { .loop_analysis => { - var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}; + var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty; defer old_breaks.deinit(gpa); - var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}; + var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty; defer old_live.deinit(gpa); if (is_dispatch_loop) { diff --git a/src/Liveness/Verify.zig b/src/Liveness/Verify.zig index 87ba6a3fc8..b6b7d40893 100644 --- a/src/Liveness/Verify.zig +++ b/src/Liveness/Verify.zig @@ -4,8 +4,8 @@ gpa: std.mem.Allocator, air: Air, liveness: Liveness, live: LiveMap = .{}, -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{}, -loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty, +loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty, intern_pool: *const InternPool, pub const Error = error{ LivenessInvalid, OutOfMemory }; diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index 81f5cce819..05f724cda3 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -91,7 +91,7 @@ pub const JobQueue = struct { /// `table` may be missing some tasks such as ones that failed, so this /// field contains references to all of them. /// Protected by `mutex`. - all_fetches: std.ArrayListUnmanaged(*Fetch) = .{}, + all_fetches: std.ArrayListUnmanaged(*Fetch) = .empty, http_client: *std.http.Client, thread_pool: *ThreadPool, @@ -1439,7 +1439,7 @@ fn computeHash( // Track directories which had any files deleted from them so that empty directories // can be deleted. - var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .{}; + var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty; defer sus_dirs.deinit(gpa); var walker = try root_dir.walk(gpa); @@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void { } const Filter = struct { - include_paths: std.StringArrayHashMapUnmanaged(void) = .{}, + include_paths: std.StringArrayHashMapUnmanaged(void) = .empty, /// sub_path is relative to the package root. pub fn includePath(self: Filter, sub_path: []const u8) bool { @@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct { var package_dir = try self.packageDir(); defer package_dir.close(); - var actual_files: std.ArrayListUnmanaged([]u8) = .{}; + var actual_files: std.ArrayListUnmanaged([]u8) = .empty; defer actual_files.deinit(std.testing.allocator); defer for (actual_files.items) |file| std.testing.allocator.free(file); var walker = try package_dir.walk(std.testing.allocator); diff --git a/src/Package/Fetch/git.zig b/src/Package/Fetch/git.zig index a8c106412e..7c2fa21b54 100644 --- a/src/Package/Fetch/git.zig +++ b/src/Package/Fetch/git.zig @@ -38,7 +38,7 @@ test parseOid { pub const Diagnostics = struct { allocator: Allocator, - errors: std.ArrayListUnmanaged(Error) = .{}, + errors: std.ArrayListUnmanaged(Error) = .empty, pub const Error = union(enum) { unable_to_create_sym_link: struct { @@ -263,7 +263,7 @@ const Odb = struct { fn readObject(odb: *Odb) !Object { var base_offset = try odb.pack_file.getPos(); var base_header: EntryHeader = undefined; - var delta_offsets = std.ArrayListUnmanaged(u64){}; + var delta_offsets: std.ArrayListUnmanaged(u64) = .empty; defer delta_offsets.deinit(odb.allocator); const base_object = while (true) { if (odb.cache.get(base_offset)) |base_object| break base_object; @@ -361,7 +361,7 @@ const Object = struct { /// freed by the caller at any point after inserting it into the cache. Any /// objects remaining in the cache will be freed when the cache itself is freed. const ObjectCache = struct { - objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .{}, + objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .empty, lru_nodes: LruList = .{}, byte_size: usize = 0, @@ -660,7 +660,7 @@ pub const Session = struct { upload_pack_uri.query = null; upload_pack_uri.fragment = null; - var body = std.ArrayListUnmanaged(u8){}; + var body: std.ArrayListUnmanaged(u8) = .empty; defer body.deinit(allocator); const body_writer = body.writer(allocator); try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer); @@ -767,7 +767,7 @@ pub const Session = struct { upload_pack_uri.query = null; upload_pack_uri.fragment = null; - var body = std.ArrayListUnmanaged(u8){}; + var body: std.ArrayListUnmanaged(u8) = .empty; defer body.deinit(allocator); const body_writer = body.writer(allocator); try Packet.write(.{ .data = "command=fetch\n" }, body_writer); @@ -1044,9 +1044,9 @@ const IndexEntry = struct { pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void { try pack.seekTo(0); - var index_entries = std.AutoHashMapUnmanaged(Oid, IndexEntry){}; + var index_entries: std.AutoHashMapUnmanaged(Oid, IndexEntry) = .empty; defer index_entries.deinit(allocator); - var pending_deltas = std.ArrayListUnmanaged(IndexEntry){}; + var pending_deltas: std.ArrayListUnmanaged(IndexEntry) = .empty; defer pending_deltas.deinit(allocator); const pack_checksum = try indexPackFirstPass(allocator, pack, &index_entries, &pending_deltas); @@ -1068,7 +1068,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) remaining_deltas = pending_deltas.items.len; } - var oids = std.ArrayListUnmanaged(Oid){}; + var oids: std.ArrayListUnmanaged(Oid) = .empty; defer oids.deinit(allocator); try oids.ensureTotalCapacityPrecise(allocator, index_entries.count()); var index_entries_iter = index_entries.iterator(); @@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big); } - var big_offsets = std.ArrayListUnmanaged(u64){}; + var big_offsets: std.ArrayListUnmanaged(u64) = .empty; defer big_offsets.deinit(allocator); for (oids.items) |oid| { const offset = index_entries.get(oid).?.offset; @@ -1213,7 +1213,7 @@ fn indexPackHashDelta( // Figure out the chain of deltas to resolve var base_offset = delta.offset; var base_header: EntryHeader = undefined; - var delta_offsets = std.ArrayListUnmanaged(u64){}; + var delta_offsets: std.ArrayListUnmanaged(u64) = .empty; defer delta_offsets.deinit(allocator); const base_object = while (true) { if (cache.get(base_offset)) |base_object| break base_object; @@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" { "file8", "file9", }; - var actual_files: std.ArrayListUnmanaged([]u8) = .{}; + var actual_files: std.ArrayListUnmanaged([]u8) = .empty; defer actual_files.deinit(testing.allocator); defer for (actual_files.items) |file| testing.allocator.free(file); var walker = try worktree.dir.walk(testing.allocator); diff --git a/src/Sema.zig b/src/Sema.zig index 7ab60adbf2..8f097bb35f 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -13,7 +13,7 @@ gpa: Allocator, arena: Allocator, code: Zir, air_instructions: std.MultiArrayList(Air.Inst) = .{}, -air_extra: std.ArrayListUnmanaged(u32) = .{}, +air_extra: std.ArrayListUnmanaged(u32) = .empty, /// Maps ZIR to AIR. inst_map: InstMap = .{}, /// The "owner" of a `Sema` represents the root "thing" that is being analyzed. @@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded, /// They are created when an break_inline passes through a runtime condition, because /// Sema must convert comptime control flow to runtime control flow, which means /// breaking from a block. -post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .{}, +post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .empty, /// Populated with the last compile error created. err: ?*Zcu.ErrorMsg = null, /// Set to true when analyzing a func type instruction so that nested generic @@ -74,12 +74,12 @@ no_partial_func_ty: bool = false, /// The temporary arena is used for the memory of the `InferredAlloc` values /// here so the values can be dropped without any cleanup. -unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .{}, +unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .empty, /// Links every pointer derived from a base `alloc` back to that `alloc`. Used /// to detect comptime-known `const`s. /// TODO: ZIR liveness analysis would allow us to remove elements from this map. -base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, +base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .empty, /// Runtime `alloc`s are placed in this map to track all comptime-known writes /// before the corresponding `make_ptr_const` instruction. @@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, /// is comptime-known, and all stores to the pointer must be applied at comptime /// to determine the comptime value. /// Backed by gpa. -maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .{}, +maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .empty, /// Comptime-mutable allocs, and any comptime allocs which reference it, are /// stored as elements of this array. /// Pointers to such memory are represented via an index into this array. /// Backed by gpa. -comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .{}, +comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .empty, /// A list of exports performed by this analysis. After this `Sema` terminates, /// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`. -exports: std.ArrayListUnmanaged(Zcu.Export) = .{}, +exports: std.ArrayListUnmanaged(Zcu.Export) = .empty, /// All references registered so far by this `Sema`. This is a temporary duplicate /// of data stored in `Zcu.all_references`. It exists to avoid adding references to /// a given `AnalUnit` multiple times. -references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, -type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}, +references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, +type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, /// All dependencies registered so far by this `Sema`. This is a temporary duplicate /// of the main dependency data. It exists to avoid adding dependencies to a given /// `AnalUnit` multiple times. -dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .{}, +dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .empty, /// Whether memoization of this call is permitted. Operations with side effects global /// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed @@ -208,7 +208,7 @@ pub const InferredErrorSet = struct { /// are returned from any dependent functions. errors: NameMap = .{}, /// Other inferred error sets which this inferred error set should include. - inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}, + inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, /// The regular error set created by resolving this inferred error set. resolved: InternPool.Index = .none, @@ -508,9 +508,9 @@ pub const Block = struct { /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions /// which correspond to `switch_continue` ZIR. The switch logic will /// rewrite these to appropriate AIR switch dispatches. - extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .{}, + extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .empty, /// Same indexes, capacity, length as `extra_insts`. - extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .{}, + extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .empty, pub fn deinit(merges: *@This(), allocator: Allocator) void { merges.results.deinit(allocator); @@ -871,7 +871,7 @@ const InferredAlloc = struct { /// is known. These should be rewritten to perform any required coercions /// when the type is resolved. /// Allocated from `sema.arena`. - prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .{}, + prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .empty, }; const NeededComptimeReason = struct { @@ -2908,7 +2908,7 @@ fn createTypeName( const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail); const zir_tags = sema.code.instructions.items(.tag); - var buf: std.ArrayListUnmanaged(u8) = .{}; + var buf: std.ArrayListUnmanaged(u8) = .empty; defer buf.deinit(gpa); const writer = buf.writer(gpa); @@ -6851,11 +6851,11 @@ fn lookupInNamespace( if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) { const gpa = sema.gpa; - var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .{}; + var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .empty; defer checked_namespaces.deinit(gpa); // Keep track of name conflicts for error notes. - var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{}; + var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty; defer candidates.deinit(gpa); try checked_namespaces.put(gpa, namespace, {}); @@ -22754,7 +22754,7 @@ fn reifyUnion( break :tag_ty .{ enum_tag_ty.toIntern(), true }; } else tag_ty: { // We must track field names and set up the tag type ourselves. - var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; try field_names.ensureTotalCapacity(sema.arena, fields_len); for (field_types, 0..) |*field_ty, field_idx| { @@ -37075,7 +37075,7 @@ fn unionFields( var int_tag_ty: Type = undefined; var enum_field_names: []InternPool.NullTerminatedString = &.{}; - var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}; + var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty; var explicit_tags_seen: []bool = &.{}; if (tag_type_ref != .none) { const tag_ty_src: LazySrcLoc = .{ @@ -37126,8 +37126,8 @@ fn unionFields( enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len); } - var field_types: std.ArrayListUnmanaged(InternPool.Index) = .{}; - var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .{}; + var field_types: std.ArrayListUnmanaged(InternPool.Index) = .empty; + var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .empty; try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len); if (small.any_aligned_fields) diff --git a/src/Zcu.zig b/src/Zcu.zig index 148570d85a..7bddabaa50 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory, /// This is where all `Export` values are stored. Not all values here are necessarily valid exports; /// to enumerate all exports, `single_exports` and `multi_exports` must be consulted. -all_exports: std.ArrayListUnmanaged(Export) = .{}, +all_exports: std.ArrayListUnmanaged(Export) = .empty, /// This is a list of free indices in `all_exports`. These indices may be reused by exports from /// future semantic analysis. -free_exports: std.ArrayListUnmanaged(u32) = .{}, +free_exports: std.ArrayListUnmanaged(u32) = .empty, /// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of /// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit` /// whose analysis triggered the export. -single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, +single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, /// Like `single_exports`, but for `AnalUnit`s which perform multiple exports. /// The exports are `all_exports.items[index..][0..len]`. multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { @@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { /// `Compilation.update` of the process for a given `Compilation`. /// /// Indexes correspond 1:1 to `files`. -import_table: std.StringArrayHashMapUnmanaged(File.Index) = .{}, +import_table: std.StringArrayHashMapUnmanaged(File.Index) = .empty, /// The set of all the files which have been loaded with `@embedFile` in the Module. /// We keep track of this in order to iterate over it and check which files have been /// modified on the file system when an update is requested, as well as to cache /// `@embedFile` results. /// Keys are fully resolved file paths. This table owns the keys and values. -embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .{}, +embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .empty, /// Stores all Type and Value objects. /// The idea is that this will be periodically garbage-collected, but such logic /// is not yet implemented. intern_pool: InternPool = .{}, -analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, +analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. -failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .{}, +failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .empty, /// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed. -transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, +transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, /// This `Nav` succeeded analysis, but failed codegen. /// This may be a simple "value" `Nav`, or it may be a function. /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. -failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .{}, +failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .empty, /// Keep track of one `@compileLog` callsite per `AnalUnit`. /// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`. compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { @@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { }) = .{}, /// Using a map here for consistency with the other fields here. /// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator. -failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .{}, +failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .empty, /// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator. -failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .{}, +failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .empty, /// Key is index into `all_exports`. -failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .{}, +failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .empty, /// If analysis failed due to a cimport error, the corresponding Clang errors /// are stored here. -cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .{}, +cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .empty, /// Maximum amount of distinct error values, set by --error-limit error_limit: ErrorInt, @@ -156,19 +156,19 @@ error_limit: ErrorInt, /// Value is the number of PO dependencies of this AnalUnit. /// This value will decrease as we perform semantic analysis to learn what is outdated. /// If any of these PO deps is outdated, this value will be moved to `outdated`. -potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, +potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, /// Value is the number of PO dependencies of this AnalUnit. /// Once this value drops to 0, the AnalUnit is a candidate for re-analysis. -outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, +outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, /// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0. /// Such `AnalUnit`s are ready for immediate re-analysis. /// See `findOutdatedToAnalyze` for details. -outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, +outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, /// This contains a list of AnalUnit whose analysis or codegen failed, but the /// failure was something like running out of disk space, and trying again may /// succeed. On the next update, we will flush this list, marking all members of /// it as outdated. -retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .{}, +retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .empty, /// These are the modules which we initially queue for analysis in `Compilation.update`. /// `resolveReferences` will use these as the root of its reachability traversal. @@ -184,31 +184,31 @@ stage1_flags: packed struct { reserved: u2 = 0, } = .{}, -compile_log_text: std.ArrayListUnmanaged(u8) = .{}, +compile_log_text: std.ArrayListUnmanaged(u8) = .empty, -test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .{}, +test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty, -global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .{}, +global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .empty, /// Key is the `AnalUnit` *performing* the reference. This representation allows /// incremental updates to quickly delete references caused by a specific `AnalUnit`. /// Value is index into `all_references` of the first reference triggered by the unit. /// The `next` field on the `Reference` forms a linked list of all references /// triggered by the key `AnalUnit`. -reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, -all_references: std.ArrayListUnmanaged(Reference) = .{}, +reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +all_references: std.ArrayListUnmanaged(Reference) = .empty, /// Freelist of indices in `all_references`. -free_references: std.ArrayListUnmanaged(u32) = .{}, +free_references: std.ArrayListUnmanaged(u32) = .empty, /// Key is the `AnalUnit` *performing* the reference. This representation allows /// incremental updates to quickly delete references caused by a specific `AnalUnit`. /// Value is index into `all_type_reference` of the first reference triggered by the unit. /// The `next` field on the `TypeReference` forms a linked list of all type references /// triggered by the key `AnalUnit`. -type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, -all_type_references: std.ArrayListUnmanaged(TypeReference) = .{}, +type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +all_type_references: std.ArrayListUnmanaged(TypeReference) = .empty, /// Freelist of indices in `all_type_references`. -free_type_references: std.ArrayListUnmanaged(u32) = .{}, +free_type_references: std.ArrayListUnmanaged(u32) = .empty, panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len, /// The panic function body. @@ -338,16 +338,16 @@ 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) = .{}, + pub_decls: std.ArrayHashMapUnmanaged(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) = .{}, + priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// All `usingnamespace` declarations in this namespace which are marked `pub`. - pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{}, + pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty, /// All `usingnamespace` declarations in this namespace which are *not* marked `pub`. - priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{}, + priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty, /// All `comptime` and `test` declarations in this namespace. We store these purely so that /// incremental compilation can re-use the existing `Cau`s when a namespace changes. - other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .{}, + other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .empty, pub const Index = InternPool.NamespaceIndex; pub const OptionalIndex = InternPool.OptionalNamespaceIndex; @@ -451,7 +451,7 @@ pub const File = struct { /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen. multi_pkg: bool = false, /// List of references to this file, used for multi-package errors. - references: std.ArrayListUnmanaged(File.Reference) = .{}, + references: std.ArrayListUnmanaged(File.Reference) = .empty, /// The most recent successful ZIR for this file, with no errors. /// This is only populated when a previously successful ZIR @@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew( old_inst: Zir.Inst.Index, new_inst: Zir.Inst.Index, }; - var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .{}; + var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .empty; defer match_stack.deinit(gpa); // Used as temporary buffers for namespace declaration instructions - var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer old_decls.deinit(gpa); - var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer new_decls.deinit(gpa); // Map the main struct inst (and anything in its fields) @@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew( try inst_map.put(gpa, match_item.old_inst, match_item.new_inst); // Maps decl name to `declaration` instruction. - var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{}; + var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty; defer named_decls.deinit(gpa); // Maps test name to `declaration` instruction. - var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{}; + var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty; defer named_tests.deinit(gpa); // All unnamed tests, in order, for a best-effort match. - var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer unnamed_tests.deinit(gpa); // All comptime declarations, in order, for a best-effort match. - var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer comptime_decls.deinit(gpa); // All usingnamespace declarations, in order, for a best-effort match. - var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer usingnamespace_decls.deinit(gpa); { @@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve const comp = zcu.comp; const ip = &zcu.intern_pool; - var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{}; + var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; errdefer result.deinit(gpa); - var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}; - var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .{}; - var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{}; + var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty; + var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .empty; + var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; defer { checked_types.deinit(gpa); type_queue.deinit(gpa); diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 17c5413b30..837895f783 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { const gpa = zcu.gpa; // We need to visit every updated File for every TrackedInst in InternPool. - var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .{}; + var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .empty; defer cleanupUpdatedFiles(gpa, &updated_files); for (zcu.import_table.values()) |file_index| { const file = zcu.fileByIndex(file_index); @@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { }; if (!has_namespace) continue; - var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; defer old_names.deinit(zcu.gpa); { var it = old_zir.declIterator(old_inst); @@ -1721,7 +1721,7 @@ pub fn scanNamespace( // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather // than their name. We'll build an efficient mapping now, then discard the current `decls`. // We map to the `Cau`, since not every declaration has a `Nav`. - var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .{}; + var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .empty; defer existing_by_inst.deinit(gpa); try existing_by_inst.ensureTotalCapacity(gpa, @intCast( @@ -1761,7 +1761,7 @@ pub fn scanNamespace( } } - var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; defer seen_decls.deinit(gpa); namespace.pub_decls.clearRetainingCapacity(); @@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void { const gpa = zcu.gpa; // First, construct a mapping of every exported value and Nav to the indices of all its different exports. - var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .{}; - var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .{}; + var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .empty; + var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .empty; defer { for (nav_exports.values()) |*exports| { exports.deinit(gpa); diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 463fdde844..649be16c06 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -62,7 +62,7 @@ stack_align: u32, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -71,13 +71,13 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// We postpone the creation of debug info for function args and locals /// until after all Mir instructions have been generated. Only then we /// will know saved_regs_stack_space which is necessary in order to /// calculate the right stack offsest with respect to the `.fp` register. -dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, +dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, branch_stack: *std.ArrayList(Branch), // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, /// Maps offset to what is stored there. -stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, +stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, /// Tracks the current instruction allocated to the compare flags compare_flags_inst: ?Air.Inst.Index = null, @@ -247,7 +247,7 @@ const DbgInfoReloc = struct { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/arch/aarch64/Emit.zig b/src/arch/aarch64/Emit.zig index 860a264e72..f6b6564f58 100644 --- a/src/arch/aarch64/Emit.zig +++ b/src/arch/aarch64/Emit.zig @@ -33,18 +33,18 @@ prev_di_pc: usize, saved_regs_stack_space: u32, /// The branch type of every branch -branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, +branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, /// For every forward branch, maps the target instruction to a list of /// branches which branch to this target instruction -branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, +branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, /// For backward branches: stores the code offset of the target /// instruction /// /// For forward branches: stores the code offset of the branch /// instruction -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, /// The final stack frame size of the function (already aligned to the /// respective stack alignment). Does not include prologue stack space. @@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void { if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { try origin_list.append(gpa, inst); } else { - var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; + var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; try origin_list.append(gpa, inst); try emit.branch_forward_origins.put(gpa, target_inst, origin_list); } diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index a0b529b75e..48137d4413 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -62,7 +62,7 @@ stack_align: u32, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -71,13 +71,13 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// We postpone the creation of debug info for function args and locals /// until after all Mir instructions have been generated. Only then we /// will know saved_regs_stack_space which is necessary in order to /// calculate the right stack offsest with respect to the `.fp` register. -dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, +dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, branch_stack: *std.ArrayList(Branch), // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, /// Maps offset to what is stored there. -stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, +stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, /// Tracks the current instruction allocated to the compare flags cpsr_flags_inst: ?Air.Inst.Index = null, @@ -168,7 +168,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/arch/arm/Emit.zig b/src/arch/arm/Emit.zig index 9ccef5a299..03940dfc3c 100644 --- a/src/arch/arm/Emit.zig +++ b/src/arch/arm/Emit.zig @@ -40,16 +40,16 @@ saved_regs_stack_space: u32, stack_size: u32, /// The branch type of every branch -branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, +branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, /// For every forward branch, maps the target instruction to a list of /// branches which branch to this target instruction -branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, +branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, /// For backward branches: stores the code offset of the target /// instruction /// /// For forward branches: stores the code offset of the branch /// instruction -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, const InnerError = error{ OutOfMemory, @@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void { if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { try origin_list.append(gpa, inst); } else { - var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; + var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; try origin_list.append(gpa, inst); try emit.branch_forward_origins.put(gpa, target_inst, origin_list); } diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 262dad6d24..f887c6cb13 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -81,7 +81,7 @@ scope_generation: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -97,14 +97,14 @@ avl: ?u64, vtype: ?bits.VType, // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, const_tracking: ConstTrackingMap = .{}, inst_tracking: InstTrackingMap = .{}, frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, -free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{}, +free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { @@ -342,7 +342,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(func: *Branch, gpa: Allocator) void { func.inst_table.deinit(gpa); @@ -621,7 +621,7 @@ const FrameAlloc = struct { }; const BlockData = struct { - relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, state: State, fn deinit(bd: *BlockData, gpa: Allocator) void { @@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { const Label = struct { target: Mir.Inst.Index = undefined, - pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, const Kind = enum { definition, reference }; @@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { return name.len > 0; } }; - var labels: std.StringHashMapUnmanaged(Label) = .{}; + var labels: std.StringHashMapUnmanaged(Label) = .empty; defer { var label_it = labels.valueIterator(); while (label_it.next()) |label| label.pending_relocs.deinit(func.gpa); diff --git a/src/arch/riscv64/Emit.zig b/src/arch/riscv64/Emit.zig index 8ee566c7ed..2c4c04d5d3 100644 --- a/src/arch/riscv64/Emit.zig +++ b/src/arch/riscv64/Emit.zig @@ -10,8 +10,8 @@ prev_di_column: u32, /// Relative to the beginning of `code`. prev_di_pc: usize, -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, -relocs: std.ArrayListUnmanaged(Reloc) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, +relocs: std.ArrayListUnmanaged(Reloc) = .empty, pub const Error = Lower.Error || error{ EmitFail, diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 589e9978a2..f2ffd517f9 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -68,7 +68,7 @@ stack_align: Alignment, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -77,7 +77,7 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, branch_stack: *std.ArrayList(Branch), // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, /// Maps offset to what is stored there. -stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, +stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, /// Tracks the current instruction allocated to the condition flags condition_flags_inst: ?Air.Inst.Index = null, @@ -201,7 +201,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/arch/sparc64/Emit.zig b/src/arch/sparc64/Emit.zig index a87c9cd0ae..ca50aa50c6 100644 --- a/src/arch/sparc64/Emit.zig +++ b/src/arch/sparc64/Emit.zig @@ -30,16 +30,16 @@ prev_di_column: u32, prev_di_pc: usize, /// The branch type of every branch -branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, +branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, /// For every forward branch, maps the target instruction to a list of /// branches which branch to this target instruction -branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, +branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, /// For backward branches: stores the code offset of the target /// instruction /// /// For forward branches: stores the code offset of the branch /// instruction -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, const InnerError = error{ OutOfMemory, @@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void { if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { try origin_list.append(gpa, inst); } else { - var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; + var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; try origin_list.append(gpa, inst); try emit.branch_forward_origins.put(gpa, target_inst, origin_list); } diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 4c42cd4ad2..193bd27a38 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -654,7 +654,7 @@ func_index: InternPool.Index, /// When we return from a branch, the branch will be popped from this list, /// which means branches can only contain references from within its own branch, /// or a branch higher (lower index) in the tree. -branches: std.ArrayListUnmanaged(Branch) = .{}, +branches: std.ArrayListUnmanaged(Branch) = .empty, /// Table to save `WValue`'s generated by an `Air.Inst` // values: ValueTable, /// Mapping from Air.Inst.Index to block ids @@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct { value: WValue, }) = .{}, /// Maps `loop` instructions to their label. `br` to here repeats the loop. -loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .{}, +loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty, /// `bytes` contains the wasm bytecode belonging to the 'code' section. code: *ArrayList(u8), /// The index the next local generated will have @@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8), /// List of simd128 immediates. Each value is stored as an array of bytes. /// This list will only be populated for 128bit-simd values when the target features /// are enabled also. -simd_immediates: std.ArrayListUnmanaged([16]u8) = .{}, +simd_immediates: std.ArrayListUnmanaged([16]u8) = .empty, /// The Target we're emitting (used to call intInfo) target: *const std.Target, /// Represents the wasm binary file that is being linked. @@ -690,7 +690,7 @@ pt: Zcu.PerThread, /// List of MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// Contains extra data for MIR -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// When a function is executing, we store the the current stack pointer's value within this local. /// This value is then used to restore the stack pointer to the original value at the return of the function. initial_stack_value: WValue = .none, @@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16", // allows us to re-use locals that are no longer used. e.g. a temporary local. /// A list of indexes which represents a local of valtype `i32`. /// It is illegal to store a non-i32 valtype in this list. -free_locals_i32: std.ArrayListUnmanaged(u32) = .{}, +free_locals_i32: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `i64`. /// It is illegal to store a non-i64 valtype in this list. -free_locals_i64: std.ArrayListUnmanaged(u32) = .{}, +free_locals_i64: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `f32`. /// It is illegal to store a non-f32 valtype in this list. -free_locals_f32: std.ArrayListUnmanaged(u32) = .{}, +free_locals_f32: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `f64`. /// It is illegal to store a non-f64 valtype in this list. -free_locals_f64: std.ArrayListUnmanaged(u32) = .{}, +free_locals_f64: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `v127`. /// It is illegal to store a non-v128 valtype in this list. -free_locals_v128: std.ArrayListUnmanaged(u32) = .{}, +free_locals_v128: std.ArrayListUnmanaged(u32) = .empty, /// When in debug mode, this tracks if no `finishAir` was missed. /// Forgetting to call `finishAir` will cause the result to not be diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 2d0b35a636..01e60367ea 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -78,7 +78,7 @@ eflags_inst: ?Air.Inst.Index = null, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -87,13 +87,13 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, const_tracking: ConstTrackingMap = .{}, inst_tracking: InstTrackingMap = .{}, // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, @@ -101,7 +101,7 @@ register_manager: RegisterManager = .{}, scope_generation: u32 = 0, frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, -free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{}, +free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { @@ -799,7 +799,7 @@ const StackAllocation = struct { }; const BlockData = struct { - relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, state: State, fn deinit(self: *BlockData, gpa: Allocator) void { @@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { const Label = struct { target: Mir.Inst.Index = undefined, - pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, const Kind = enum { definition, reference }; @@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { return name.len > 0; } }; - var labels: std.StringHashMapUnmanaged(Label) = .{}; + var labels: std.StringHashMapUnmanaged(Label) = .empty; defer { var label_it = labels.valueIterator(); while (label_it.next()) |label| label.pending_relocs.deinit(self.gpa); diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index 372a520e52..c33fbb53a5 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -11,8 +11,8 @@ prev_di_column: u32, /// Relative to the beginning of `code`. prev_di_pc: usize, -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, -relocs: std.ArrayListUnmanaged(Reloc) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, +relocs: std.ArrayListUnmanaged(Reloc) = .empty, pub const Error = Lower.Error || error{ EmitFail, diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 0ec5513b6f..466bdcde6a 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -304,14 +304,14 @@ pub const Function = struct { air: Air, liveness: Liveness, value_map: CValueMap, - blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, + blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, next_arg_index: usize = 0, next_block_index: usize = 0, object: Object, lazy_fns: LazyFnMap, func_index: InternPool.Index, /// All the locals, to be emitted at the top of the function. - locals: std.ArrayListUnmanaged(Local) = .{}, + locals: std.ArrayListUnmanaged(Local) = .empty, /// Which locals are available for reuse, based on Type. free_locals_map: LocalsMap = .{}, /// Locals which will not be freed by Liveness. This is used after a @@ -320,10 +320,10 @@ pub const Function = struct { /// of variable declarations at the top of a function, sorted descending /// by type alignment. /// The value is whether the alloc needs to be emitted in the header. - allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{}, + allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .empty, /// Maps from `loop_switch_br` instructions to the allocated local used /// for the switch cond. Dispatches should set this local to the new cond. - loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .{}, + loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .empty, fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue { const gop = try f.value_map.getOrPut(ref); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 956ed7de08..ec2ba4e4c1 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1500,7 +1500,7 @@ pub const Object = struct { // instructions. Depending on the calling convention, this list is not necessarily // a bijection with the actual LLVM parameters of the function. const gpa = o.gpa; - var args: std.ArrayListUnmanaged(Builder.Value) = .{}; + var args: std.ArrayListUnmanaged(Builder.Value) = .empty; defer args.deinit(gpa); { @@ -2497,7 +2497,7 @@ pub const Object = struct { switch (ip.indexToKey(ty.toIntern())) { .anon_struct_type => |tuple| { - var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; + var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; defer fields.deinit(gpa); try fields.ensureUnusedCapacity(gpa, tuple.types.len); @@ -2574,7 +2574,7 @@ pub const Object = struct { const struct_type = zcu.typeToStruct(ty).?; - var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; + var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; defer fields.deinit(gpa); try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len); @@ -2667,7 +2667,7 @@ pub const Object = struct { return debug_union_type; } - var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; + var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; defer fields.deinit(gpa); try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len); @@ -3412,7 +3412,7 @@ pub const Object = struct { return int_ty; } - var llvm_field_types = std.ArrayListUnmanaged(Builder.Type){}; + var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty; defer llvm_field_types.deinit(o.gpa); // Although we can estimate how much capacity to add, these cannot be // relied upon because of the recursive calls to lowerType below. @@ -3481,7 +3481,7 @@ pub const Object = struct { return ty; }, .anon_struct_type => |anon_struct_type| { - var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .{}; + var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty; defer llvm_field_types.deinit(o.gpa); // Although we can estimate how much capacity to add, these cannot be // relied upon because of the recursive calls to lowerType below. @@ -3672,7 +3672,7 @@ pub const Object = struct { const target = zcu.getTarget(); const ret_ty = try lowerFnRetTy(o, fn_info); - var llvm_params = std.ArrayListUnmanaged(Builder.Type){}; + var llvm_params: std.ArrayListUnmanaged(Builder.Type) = .empty; defer llvm_params.deinit(o.gpa); if (firstParamSRet(fn_info, zcu, target)) { @@ -7438,7 +7438,7 @@ pub const FuncGen = struct { const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]); extra_i += inputs.len; - var llvm_constraints: std.ArrayListUnmanaged(u8) = .{}; + var llvm_constraints: std.ArrayListUnmanaged(u8) = .empty; defer llvm_constraints.deinit(self.gpa); var arena_allocator = std.heap.ArenaAllocator.init(self.gpa); @@ -7466,7 +7466,7 @@ pub const FuncGen = struct { var llvm_param_i: usize = 0; var total_i: u16 = 0; - var name_map: std.StringArrayHashMapUnmanaged(u16) = .{}; + var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty; try name_map.ensureUnusedCapacity(arena, max_param_count); var rw_extra_i = extra_i; diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index f6bfcab1ad..d3aa6e34c4 100644 --- a/src/codegen/llvm/Builder.zig +++ b/src/codegen/llvm/Builder.zig @@ -3994,7 +3994,7 @@ pub const Function = struct { names: [*]const String = &[0]String{}, value_indices: [*]const u32 = &[0]u32{}, strip: bool, - debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}, + debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty, debug_values: []const Instruction.Index = &.{}, extra: []const u32 = &.{}, @@ -6166,7 +6166,7 @@ pub const WipFunction = struct { const value_indices = try gpa.alloc(u32, final_instructions_len); errdefer gpa.free(value_indices); - var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}; + var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty; errdefer debug_locations.deinit(gpa); try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count())); @@ -9557,7 +9557,7 @@ pub fn printUnbuffered( } } - var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .{}; + var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .empty; defer attribute_groups.deinit(self.gpa); for (0.., self.functions.items) |function_i, function| { @@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co // Write LLVM IR magic try bitcode.writeBits(ir.MAGIC, 32); - var record: std.ArrayListUnmanaged(u64) = .{}; + var record: std.ArrayListUnmanaged(u64) = .empty; defer record.deinit(self.gpa); // IDENTIFICATION_BLOCK @@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co try paramattr_block.end(); } - var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .{}; + var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .empty; defer globals.deinit(self.gpa); try globals.ensureUnusedCapacity( self.gpa, @@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co // Globals { - var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .{}; + var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .empty; defer section_map.deinit(self.gpa); try section_map.ensureUnusedCapacity(self.gpa, globals.count()); diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index afc7641072..dc45b26931 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -79,7 +79,7 @@ const ControlFlow = union(enum) { selection: struct { /// In order to know which merges we still need to do, we need to keep /// a stack of those. - merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .{}, + merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .empty, }, /// For a `loop` type block, we can early-exit the block by /// jumping to the loop exit node, and we don't need to generate @@ -87,7 +87,7 @@ const ControlFlow = union(enum) { loop: struct { /// The next block to jump to can be determined from any number /// of conditions that jump to the loop exit. - merges: std.ArrayListUnmanaged(Incoming) = .{}, + merges: std.ArrayListUnmanaged(Incoming) = .empty, /// The label id of the loop's merge block. merge_block: IdRef, }, @@ -102,10 +102,10 @@ const ControlFlow = union(enum) { }; /// The stack of (structured) blocks that we are currently in. This determines /// how exits from the current block must be handled. - block_stack: std.ArrayListUnmanaged(*Structured.Block) = .{}, + block_stack: std.ArrayListUnmanaged(*Structured.Block) = .empty, /// Maps `block` inst indices to the variable that the block's result /// value must be written to. - block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .{}, + block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .empty, }; const Unstructured = struct { @@ -116,12 +116,12 @@ const ControlFlow = union(enum) { const Block = struct { label: ?IdRef = null, - incoming_blocks: std.ArrayListUnmanaged(Incoming) = .{}, + incoming_blocks: std.ArrayListUnmanaged(Incoming) = .empty, }; /// We need to keep track of result ids for block labels, as well as the 'incoming' /// blocks for a block. - blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .{}, + blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .empty, }; structured: Structured, @@ -153,10 +153,10 @@ pub const Object = struct { /// The Zig module that this object file is generated for. /// A map of Zig decl indices to SPIR-V decl indices. - nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .{}, + nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .empty, /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices. - uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .{}, + uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .empty, /// A map that maps AIR intern pool indices to SPIR-V result-ids. intern_map: InternMap = .{}, @@ -300,7 +300,7 @@ const NavGen = struct { /// An array of function argument result-ids. Each index corresponds with the /// function argument of the same index. - args: std.ArrayListUnmanaged(IdRef) = .{}, + args: std.ArrayListUnmanaged(IdRef) = .empty, /// A counter to keep track of how many `arg` instructions we've seen yet. next_arg_index: u32 = 0, @@ -6270,7 +6270,7 @@ const NavGen = struct { } } - var incoming_structured_blocks = std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming){}; + var incoming_structured_blocks: std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming) = .empty; defer incoming_structured_blocks.deinit(self.gpa); if (self.control_flow == .structured) { diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 2cbb873d30..9e39f2ed09 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue); gpa: Allocator, /// A list of errors that occured during processing the assembly. -errors: std.ArrayListUnmanaged(ErrorMsg) = .{}, +errors: std.ArrayListUnmanaged(ErrorMsg) = .empty, /// The source code that is being assembled. src: []const u8, @@ -161,7 +161,7 @@ spv: *SpvModule, func: *SpvModule.Fn, /// `self.src` tokenized. -tokens: std.ArrayListUnmanaged(Token) = .{}, +tokens: std.ArrayListUnmanaged(Token) = .empty, /// The token that is next during parsing. current_token: u32 = 0, @@ -172,9 +172,9 @@ inst: struct { /// The opcode of the current instruction. opcode: Opcode = undefined, /// Operands of the current instruction. - operands: std.ArrayListUnmanaged(Operand) = .{}, + operands: std.ArrayListUnmanaged(Operand) = .empty, /// This is where string data resides. Strings are zero-terminated. - string_bytes: std.ArrayListUnmanaged(u8) = .{}, + string_bytes: std.ArrayListUnmanaged(u8) = .empty, /// Return a reference to the result of this instruction, if any. fn result(self: @This()) ?AsmValue.Ref { @@ -196,7 +196,7 @@ value_map: AsmValueMap = .{}, /// This set is used to quickly transform from an opcode name to the /// index in its instruction set. The index of the key is the /// index in `spec.InstructionSet.core.instructions()`. -instruction_map: std.StringArrayHashMapUnmanaged(void) = .{}, +instruction_map: std.StringArrayHashMapUnmanaged(void) = .empty, /// Free the resources owned by this assembler. pub fn deinit(self: *Assembler) void { diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index ae30de156b..94787e06b9 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -35,7 +35,7 @@ pub const Fn = struct { /// the end of this function definition. body: Section = .{}, /// The decl dependencies that this function depends on. - decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .{}, + decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .empty, /// Reset this function without deallocating resources, so that /// it may be used to emit code for another function. @@ -141,7 +141,7 @@ sections: struct { next_result_id: Word, /// Cache for results of OpString instructions. -strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, +strings: std.StringArrayHashMapUnmanaged(IdRef) = .empty, /// Some types shouldn't be emitted more than one time, but cannot be caught by /// the `intern_map` during codegen. Sometimes, IDs are compared to check if @@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, cache: struct { bool_type: ?IdRef = null, void_type: ?IdRef = null, - int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .{}, - float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .{}, + int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .empty, + float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .empty, // This cache is required so that @Vector(X, u1) in direct representation has the // same ID as @Vector(X, bool) in indirect representation. - vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .{}, + vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .empty, - builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .{}, + builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .empty, } = .{}, /// Set of Decls, referred to by Decl.Index. -decls: std.ArrayListUnmanaged(Decl) = .{}, +decls: std.ArrayListUnmanaged(Decl) = .empty, /// List of dependencies, per decl. This list holds all the dependencies, sliced by the /// begin_dep and end_dep in `self.decls`. -decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{}, +decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty, /// The list of entry points that should be exported from this module. -entry_points: std.ArrayListUnmanaged(EntryPoint) = .{}, +entry_points: std.ArrayListUnmanaged(EntryPoint) = .empty, /// The list of extended instruction sets that should be imported. -extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{}, +extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .empty, pub fn init(gpa: Allocator) Module { return .{ diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index 20abf8ab70..1fdf884bdb 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -15,7 +15,7 @@ const Opcode = spec.Opcode; /// The instructions in this section. Memory is owned by the Module /// externally associated to this Section. -instructions: std.ArrayListUnmanaged(Word) = .{}, +instructions: std.ArrayListUnmanaged(Word) = .empty, pub fn deinit(section: *Section, allocator: Allocator) void { section.instructions.deinit(allocator); diff --git a/src/link/C.zig b/src/link/C.zig index 7d00ad9028..a674b256b0 100644 --- a/src/link/C.zig +++ b/src/link/C.zig @@ -26,34 +26,34 @@ base: link.File, /// This linker backend does not try to incrementally link output C source code. /// Instead, it tracks all declarations in this table, and iterates over it /// in the flush function, stitching pre-rendered pieces of C code together. -navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .{}, +navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .empty, /// All the string bytes of rendered C code, all squished into one array. /// While in progress, a separate buffer is used, and then when finished, the /// buffer is copied into this one. -string_bytes: std.ArrayListUnmanaged(u8) = .{}, +string_bytes: std.ArrayListUnmanaged(u8) = .empty, /// Tracks all the anonymous decls that are used by all the decls so they can /// be rendered during flush(). -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .{}, +uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .empty, /// Sparse set of uavs that are overaligned. Underaligned anon decls are /// lowered the same as ABI-aligned anon decls. The keys here are a subset of /// the keys of `uavs`. -aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .{}, +aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty, -exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .{}, -exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .{}, +exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .empty, +exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .empty, /// Optimization, `updateDecl` reuses this buffer rather than creating a new /// one with every call. -fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{}, +fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty, /// Optimization, `updateDecl` reuses this buffer rather than creating a new /// one with every call. -code_buf: std.ArrayListUnmanaged(u8) = .{}, +code_buf: std.ArrayListUnmanaged(u8) = .empty, /// Optimization, `flush` reuses this buffer rather than creating a new /// one with every call. -lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{}, +lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty, /// Optimization, `flush` reuses this buffer rather than creating a new /// one with every call. -lazy_code_buf: std.ArrayListUnmanaged(u8) = .{}, +lazy_code_buf: std.ArrayListUnmanaged(u8) = .empty, /// A reference into `string_bytes`. const String = extern struct { @@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: // `CType`s, forward decls, and non-functions first. { - var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; defer export_names.deinit(gpa); try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count())); for (zcu.single_exports.values()) |export_index| { @@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: const Flush = struct { ctype_pool: codegen.CType.Pool, - ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .{}, - ctypes_buf: std.ArrayListUnmanaged(u8) = .{}, + ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .empty, + ctypes_buf: std.ArrayListUnmanaged(u8) = .empty, lazy_ctype_pool: codegen.CType.Pool, lazy_fns: LazyFns = .{}, - asm_buf: std.ArrayListUnmanaged(u8) = .{}, + asm_buf: std.ArrayListUnmanaged(u8) = .empty, /// We collect a list of buffers to write, and write them all at once with pwritev 😎 - all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .{}, + all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .empty, /// Keeps track of the total bytes of `all_buffers`. file_size: u64 = 0, diff --git a/src/link/Coff.zig b/src/link/Coff.zig index f67c7d54d7..24040cb2f8 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -26,7 +26,7 @@ repro: bool, ptr_width: PtrWidth, page_size: u32, -objects: std.ArrayListUnmanaged(Object) = .{}, +objects: std.ArrayListUnmanaged(Object) = .empty, sections: std.MultiArrayList(Section) = .{}, data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory, @@ -38,14 +38,14 @@ data_section_index: ?u16 = null, reloc_section_index: ?u16 = null, idata_section_index: ?u16 = null, -locals: std.ArrayListUnmanaged(coff.Symbol) = .{}, -globals: std.ArrayListUnmanaged(SymbolWithLoc) = .{}, -resolver: std.StringHashMapUnmanaged(u32) = .{}, -unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .{}, -need_got_table: std.AutoHashMapUnmanaged(u32, void) = .{}, +locals: std.ArrayListUnmanaged(coff.Symbol) = .empty, +globals: std.ArrayListUnmanaged(SymbolWithLoc) = .empty, +resolver: std.StringHashMapUnmanaged(u32) = .empty, +unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .empty, +need_got_table: std.AutoHashMapUnmanaged(u32, void) = .empty, -locals_free_list: std.ArrayListUnmanaged(u32) = .{}, -globals_free_list: std.ArrayListUnmanaged(u32) = .{}, +locals_free_list: std.ArrayListUnmanaged(u32) = .empty, +globals_free_list: std.ArrayListUnmanaged(u32) = .empty, strtab: StringTable = .{}, strtab_offset: ?u32 = null, @@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{}, /// A table of ImportTables partitioned by the library name. /// Key is an offset into the interning string table `temp_strtab`. -import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .{}, +import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .empty, got_table_count_dirty: bool = true, got_table_contents_dirty: bool = true, @@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{}, navs: NavTable = .{}, /// List of atoms that are either synthetic or map directly to the Zig source program. -atoms: std.ArrayListUnmanaged(Atom) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, /// Table of atoms indexed by the symbol index. -atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{}, +atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty, uavs: UavTable = .{}, @@ -131,7 +131,7 @@ const Section = struct { /// overcapacity can be negative. A simple way to have negative overcapacity is to /// allocate a fresh atom, which will have ideal capacity, and then grow it /// by 1 byte. It will then have -1 overcapacity. - free_list: std.ArrayListUnmanaged(Atom.Index) = .{}, + free_list: std.ArrayListUnmanaged(Atom.Index) = .empty, }; const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata); @@ -148,7 +148,7 @@ const AvMetadata = struct { atom: Atom.Index, section: u16, /// A list of all exports aliases of this Decl. - exports: std.ArrayListUnmanaged(u32) = .{}, + exports: std.ArrayListUnmanaged(u32) = .empty, fn deinit(m: *AvMetadata, allocator: Allocator) void { m.exports.deinit(allocator); diff --git a/src/link/Coff/ImportTable.zig b/src/link/Coff/ImportTable.zig index c25851fe72..9ce00cf5ee 100644 --- a/src/link/Coff/ImportTable.zig +++ b/src/link/Coff/ImportTable.zig @@ -26,9 +26,9 @@ //! DLL#2 name //! --- END -entries: std.ArrayListUnmanaged(SymbolWithLoc) = .{}, -free_list: std.ArrayListUnmanaged(u32) = .{}, -lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .{}, +entries: std.ArrayListUnmanaged(SymbolWithLoc) = .empty, +free_list: std.ArrayListUnmanaged(u32) = .empty, +lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .empty, pub fn deinit(itab: *ImportTable, allocator: Allocator) void { itab.entries.deinit(allocator); diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 333501b29f..ba3abcf330 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{}, /// Long-lived list of all file descriptors. /// We store them globally rather than per actual File so that we can re-use /// one file handle per every object file within an archive. -file_handles: std.ArrayListUnmanaged(File.Handle) = .{}, +file_handles: std.ArrayListUnmanaged(File.Handle) = .empty, zig_object_index: ?File.Index = null, linker_defined_index: ?File.Index = null, -objects: std.ArrayListUnmanaged(File.Index) = .{}, -shared_objects: std.ArrayListUnmanaged(File.Index) = .{}, +objects: std.ArrayListUnmanaged(File.Index) = .empty, +shared_objects: std.ArrayListUnmanaged(File.Index) = .empty, /// List of all output sections and their associated metadata. sections: std.MultiArrayList(Section) = .{}, @@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null, /// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write. /// Same order as in the file. -phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .{}, +phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .empty, /// Special program headers /// PT_PHDR @@ -77,23 +77,23 @@ page_size: u32, default_sym_version: elf.Elf64_Versym, /// .shstrtab buffer -shstrtab: std.ArrayListUnmanaged(u8) = .{}, +shstrtab: std.ArrayListUnmanaged(u8) = .empty, /// .symtab buffer -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, /// .strtab buffer -strtab: std.ArrayListUnmanaged(u8) = .{}, +strtab: std.ArrayListUnmanaged(u8) = .empty, /// Dynamic symbol table. Only populated and emitted when linking dynamically. dynsym: DynsymSection = .{}, /// .dynstrtab buffer -dynstrtab: std.ArrayListUnmanaged(u8) = .{}, +dynstrtab: std.ArrayListUnmanaged(u8) = .empty, /// Version symbol table. Only populated and emitted when linking dynamically. -versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, +versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty, /// .verneed section verneed: VerneedSection = .{}, /// .got section got: GotSection = .{}, /// .rela.dyn section -rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, +rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, /// .dynamic section dynamic: DynamicSection = .{}, /// .hash section @@ -109,10 +109,10 @@ plt_got: PltGotSection = .{}, /// .copyrel section copy_rel: CopyRelSection = .{}, /// .rela.plt section -rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, +rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, /// SHT_GROUP sections /// Applies only to a relocatable. -comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .{}, +comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .empty, copy_rel_section_index: ?u32 = null, dynamic_section_index: ?u32 = null, @@ -143,10 +143,10 @@ has_text_reloc: bool = false, num_ifunc_dynrelocs: usize = 0, /// List of range extension thunks. -thunks: std.ArrayListUnmanaged(Thunk) = .{}, +thunks: std.ArrayListUnmanaged(Thunk) = .empty, /// List of output merge sections with deduped contents. -merge_sections: std.ArrayListUnmanaged(MergeSection) = .{}, +merge_sections: std.ArrayListUnmanaged(MergeSection) = .empty, first_eflags: ?elf.Elf64_Word = null, @@ -5487,9 +5487,9 @@ pub const Ref = struct { }; pub const SymbolResolver = struct { - keys: std.ArrayListUnmanaged(Key) = .{}, - values: std.ArrayListUnmanaged(Ref) = .{}, - table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, + keys: std.ArrayListUnmanaged(Key) = .empty, + values: std.ArrayListUnmanaged(Ref) = .empty, + table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, const Result = struct { found_existing: bool, @@ -5586,7 +5586,7 @@ const Section = struct { /// List of atoms contributing to this section. /// TODO currently this is only used for relocations tracking in relocatable mode /// but will be merged with atom_list_2. - atom_list: std.ArrayListUnmanaged(Ref) = .{}, + atom_list: std.ArrayListUnmanaged(Ref) = .empty, /// List of atoms contributing to this section. /// This can be used by sections that require special handling such as init/fini array, etc. @@ -5610,7 +5610,7 @@ const Section = struct { /// overcapacity can be negative. A simple way to have negative overcapacity is to /// allocate a fresh text block, which will have ideal capacity, and then grow it /// by 1 byte. It will then have -1 overcapacity. - free_list: std.ArrayListUnmanaged(Ref) = .{}, + free_list: std.ArrayListUnmanaged(Ref) = .empty, }; fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 { diff --git a/src/link/Elf/Archive.zig b/src/link/Elf/Archive.zig index 030ddc13c6..8a97161034 100644 --- a/src/link/Elf/Archive.zig +++ b/src/link/Elf/Archive.zig @@ -1,5 +1,5 @@ -objects: std.ArrayListUnmanaged(Object) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +objects: std.ArrayListUnmanaged(Object) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, pub fn isArchive(path: []const u8) !bool { const file = try std.fs.cwd().openFile(path, .{}); @@ -127,7 +127,7 @@ const strtab_delimiter = '\n'; pub const max_member_name_len = 15; pub const ArSymtab = struct { - symtab: std.ArrayListUnmanaged(Entry) = .{}, + symtab: std.ArrayListUnmanaged(Entry) = .empty, strtab: StringTable = .{}, pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { @@ -241,7 +241,7 @@ pub const ArSymtab = struct { }; pub const ArStrtab = struct { - buffer: std.ArrayListUnmanaged(u8) = .{}, + buffer: std.ArrayListUnmanaged(u8) = .empty, pub fn deinit(ar: *ArStrtab, allocator: Allocator) void { ar.buffer.deinit(allocator); diff --git a/src/link/Elf/AtomList.zig b/src/link/Elf/AtomList.zig index 51407ca6d9..5fc1893376 100644 --- a/src/link/Elf/AtomList.zig +++ b/src/link/Elf/AtomList.zig @@ -2,7 +2,7 @@ value: i64 = 0, size: u64 = 0, alignment: Atom.Alignment = .@"1", output_section_index: u32 = 0, -atoms: std.ArrayListUnmanaged(Elf.Ref) = .{}, +atoms: std.ArrayListUnmanaged(Elf.Ref) = .empty, pub fn deinit(list: *AtomList, allocator: Allocator) void { list.atoms.deinit(allocator); diff --git a/src/link/Elf/LdScript.zig b/src/link/Elf/LdScript.zig index 414ce035a4..bf5efd2137 100644 --- a/src/link/Elf/LdScript.zig +++ b/src/link/Elf/LdScript.zig @@ -1,6 +1,6 @@ path: []const u8, cpu_arch: ?std.Target.Cpu.Arch = null, -args: std.ArrayListUnmanaged(Elf.SystemLib) = .{}, +args: std.ArrayListUnmanaged(Elf.SystemLib) = .empty, pub fn deinit(scr: *LdScript, allocator: Allocator) void { scr.args.deinit(allocator); diff --git a/src/link/Elf/LinkerDefined.zig b/src/link/Elf/LinkerDefined.zig index 131ed6ad71..59aea19efa 100644 --- a/src/link/Elf/LinkerDefined.zig +++ b/src/link/Elf/LinkerDefined.zig @@ -1,11 +1,11 @@ index: File.Index, -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, entry_index: ?Symbol.Index = null, dynamic_index: ?Symbol.Index = null, @@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null, rela_iplt_start_index: ?Symbol.Index = null, rela_iplt_end_index: ?Symbol.Index = null, global_pointer_index: ?Symbol.Index = null, -start_stop_indexes: std.ArrayListUnmanaged(u32) = .{}, +start_stop_indexes: std.ArrayListUnmanaged(u32) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index 18c7a91c8f..a7091b7394 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -4,29 +4,29 @@ file_handle: File.HandleIndex, index: File.Index, header: ?elf.Elf64_Ehdr = null, -shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{}, +shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty, -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, first_global: ?Symbol.Index = null, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, -relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, +relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, -comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .{}, -comdat_group_data: std.ArrayListUnmanaged(u32) = .{}, +comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .empty, +comdat_group_data: std.ArrayListUnmanaged(u32) = .empty, -input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .{}, -input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .{}, +input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .empty, +input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .empty, -fdes: std.ArrayListUnmanaged(Fde) = .{}, -cies: std.ArrayListUnmanaged(Cie) = .{}, -eh_frame_data: std.ArrayListUnmanaged(u8) = .{}, +fdes: std.ArrayListUnmanaged(Fde) = .empty, +cies: std.ArrayListUnmanaged(Cie) = .empty, +eh_frame_data: std.ArrayListUnmanaged(u8) = .empty, alive: bool = true, num_dynrelocs: u32 = 0, diff --git a/src/link/Elf/SharedObject.zig b/src/link/Elf/SharedObject.zig index 677e63ebaf..3000af39ca 100644 --- a/src/link/Elf/SharedObject.zig +++ b/src/link/Elf/SharedObject.zig @@ -2,20 +2,20 @@ path: []const u8, index: File.Index, header: ?elf.Elf64_Ehdr = null, -shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{}, +shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty, -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, /// Version symtab contains version strings of the symbols if present. -versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, -verstrings: std.ArrayListUnmanaged(u32) = .{}, +versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty, +verstrings: std.ArrayListUnmanaged(u32) = .empty, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, aliases: ?std.ArrayListUnmanaged(u32) = null, -dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .{}, +dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .empty, needed: bool, alive: bool, diff --git a/src/link/Elf/Thunk.zig b/src/link/Elf/Thunk.zig index 389ba7ffed..23dc2f3b0b 100644 --- a/src/link/Elf/Thunk.zig +++ b/src/link/Elf/Thunk.zig @@ -1,6 +1,6 @@ value: i64 = 0, output_section_index: u32 = 0, -symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .{}, +symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 98449d6a5b..671049919d 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -3,24 +3,24 @@ //! and any relocations that may have been emitted. //! Think about this as fake in-memory Object file for the Zig module. -data: std.ArrayListUnmanaged(u8) = .{}, +data: std.ArrayListUnmanaged(u8) = .empty, /// Externally owned memory. path: []const u8, index: File.Index, symtab: std.MultiArrayList(ElfSym) = .{}, strtab: StringTable = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, -local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, -global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, -globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, +local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, +global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, +globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, -relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, +relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .empty, num_dynrelocs: u32 = 0, @@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct { const AvMetadata = struct { symbol_index: Symbol.Index, /// A list of all exports aliases of this Av. - exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, + exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, /// Set to true if the AV has been initialized and allocated. allocated: bool = false, diff --git a/src/link/Elf/merge_section.zig b/src/link/Elf/merge_section.zig index 6241e1aec9..cf6506a9ea 100644 --- a/src/link/Elf/merge_section.zig +++ b/src/link/Elf/merge_section.zig @@ -7,15 +7,15 @@ pub const MergeSection = struct { type: u32 = 0, flags: u64 = 0, output_section_index: u32 = 0, - bytes: std.ArrayListUnmanaged(u8) = .{}, + bytes: std.ArrayListUnmanaged(u8) = .empty, table: std.HashMapUnmanaged( String, MergeSubsection.Index, IndexContext, std.hash_map.default_max_load_percentage, ) = .{}, - subsections: std.ArrayListUnmanaged(MergeSubsection) = .{}, - finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, + subsections: std.ArrayListUnmanaged(MergeSubsection) = .empty, + finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, pub fn deinit(msec: *MergeSection, allocator: Allocator) void { msec.bytes.deinit(allocator); @@ -276,10 +276,10 @@ pub const MergeSubsection = struct { pub const InputMergeSection = struct { merge_section_index: MergeSection.Index = 0, atom_index: Atom.Index = 0, - offsets: std.ArrayListUnmanaged(u32) = .{}, - subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, - bytes: std.ArrayListUnmanaged(u8) = .{}, - strings: std.ArrayListUnmanaged(String) = .{}, + offsets: std.ArrayListUnmanaged(u32) = .empty, + subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, + bytes: std.ArrayListUnmanaged(u8) = .empty, + strings: std.ArrayListUnmanaged(String) = .empty, pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void { imsec.offsets.deinit(allocator); diff --git a/src/link/Elf/synthetic_sections.zig b/src/link/Elf/synthetic_sections.zig index a159ba23c1..f914bb8d84 100644 --- a/src/link/Elf/synthetic_sections.zig +++ b/src/link/Elf/synthetic_sections.zig @@ -1,6 +1,6 @@ pub const DynamicSection = struct { soname: ?u32 = null, - needed: std.ArrayListUnmanaged(u32) = .{}, + needed: std.ArrayListUnmanaged(u32) = .empty, rpath: u32 = 0, pub fn deinit(dt: *DynamicSection, allocator: Allocator) void { @@ -226,7 +226,7 @@ pub const DynamicSection = struct { }; pub const GotSection = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, tlsld_index: ?u32 = null, flags: Flags = .{}, @@ -629,7 +629,7 @@ pub const GotSection = struct { }; pub const PltSection = struct { - symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, + symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(plt: *PltSection, allocator: Allocator) void { @@ -883,7 +883,7 @@ pub const GotPltSection = struct { }; pub const PltGotSection = struct { - symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, + symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void { @@ -994,7 +994,7 @@ pub const PltGotSection = struct { }; pub const CopyRelSection = struct { - symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, + symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void { copy_rel.symbols.deinit(allocator); @@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct { }; pub const DynsymSection = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, pub const Entry = struct { /// Ref of the symbol which gets privilege of getting a dynamic treatment @@ -1156,7 +1156,7 @@ pub const DynsymSection = struct { }; pub const HashSection = struct { - buffer: std.ArrayListUnmanaged(u8) = .{}, + buffer: std.ArrayListUnmanaged(u8) = .empty, pub fn deinit(hs: *HashSection, allocator: Allocator) void { hs.buffer.deinit(allocator); @@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct { }; pub const VerneedSection = struct { - verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .{}, - vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .{}, + verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .empty, + vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .empty, index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1, pub fn deinit(vern: *VerneedSection, allocator: Allocator) void { diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 27bfc9392e..42923ecfba 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{}, /// Long-lived list of all file descriptors. /// We store them globally rather than per actual File so that we can re-use /// one file handle per every object file within an archive. -file_handles: std.ArrayListUnmanaged(File.Handle) = .{}, +file_handles: std.ArrayListUnmanaged(File.Handle) = .empty, zig_object: ?File.Index = null, internal_object: ?File.Index = null, -objects: std.ArrayListUnmanaged(File.Index) = .{}, -dylibs: std.ArrayListUnmanaged(File.Index) = .{}, +objects: std.ArrayListUnmanaged(File.Index) = .empty, +dylibs: std.ArrayListUnmanaged(File.Index) = .empty, -segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, +segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, sections: std.MultiArrayList(Section) = .{}, resolver: SymbolResolver = .{}, /// This table will be populated after `scanRelocs` has run. /// Key is symbol index. -undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .{}, +undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .empty, undefs_mutex: std.Thread.Mutex = .{}, -dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .{}, +dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .empty, dupes_mutex: std.Thread.Mutex = .{}, dyld_info_cmd: macho.dyld_info_command = .{}, @@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null, unwind_info_sect_index: ?u8 = null, objc_stubs_sect_index: ?u8 = null, -thunks: std.ArrayListUnmanaged(Thunk) = .{}, +thunks: std.ArrayListUnmanaged(Thunk) = .empty, /// Output synthetic sections -symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, indsymtab: Indsymtab = .{}, got: GotSection = .{}, stubs: StubsSection = .{}, @@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main"; const Section = struct { header: macho.section_64, segment_id: u8, - atoms: std.ArrayListUnmanaged(Ref) = .{}, - free_list: std.ArrayListUnmanaged(Atom.Index) = .{}, + atoms: std.ArrayListUnmanaged(Ref) = .empty, + free_list: std.ArrayListUnmanaged(Atom.Index) = .empty, last_atom_index: Atom.Index = 0, - thunks: std.ArrayListUnmanaged(Thunk.Index) = .{}, - out: std.ArrayListUnmanaged(u8) = .{}, - relocs: std.ArrayListUnmanaged(macho.relocation_info) = .{}, + thunks: std.ArrayListUnmanaged(Thunk.Index) = .empty, + out: std.ArrayListUnmanaged(u8) = .empty, + relocs: std.ArrayListUnmanaged(macho.relocation_info) = .empty, }; pub const LiteralPool = struct { - table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, - keys: std.ArrayListUnmanaged(Key) = .{}, - values: std.ArrayListUnmanaged(MachO.Ref) = .{}, - data: std.ArrayListUnmanaged(u8) = .{}, + table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, + keys: std.ArrayListUnmanaged(Key) = .empty, + values: std.ArrayListUnmanaged(MachO.Ref) = .empty, + data: std.ArrayListUnmanaged(u8) = .empty, pub fn deinit(lp: *LiteralPool, allocator: Allocator) void { lp.table.deinit(allocator); @@ -4480,9 +4480,9 @@ pub const Ref = struct { }; pub const SymbolResolver = struct { - keys: std.ArrayListUnmanaged(Key) = .{}, - values: std.ArrayListUnmanaged(Ref) = .{}, - table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, + keys: std.ArrayListUnmanaged(Key) = .empty, + values: std.ArrayListUnmanaged(Ref) = .empty, + table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, const Result = struct { found_existing: bool, diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig index a1c8b84deb..bb589dfb66 100644 --- a/src/link/MachO/Archive.zig +++ b/src/link/MachO/Archive.zig @@ -1,4 +1,4 @@ -objects: std.ArrayListUnmanaged(Object) = .{}, +objects: std.ArrayListUnmanaged(Object) = .empty, pub fn deinit(self: *Archive, allocator: Allocator) void { self.objects.deinit(allocator); @@ -181,7 +181,7 @@ pub const ar_hdr = extern struct { }; pub const ArSymtab = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, strtab: StringTable = .{}, pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { diff --git a/src/link/MachO/CodeSignature.zig b/src/link/MachO/CodeSignature.zig index 0b9c12204f..c8a092eab6 100644 --- a/src/link/MachO/CodeSignature.zig +++ b/src/link/MachO/CodeSignature.zig @@ -53,7 +53,7 @@ const CodeDirectory = struct { inner: macho.CodeDirectory, ident: []const u8, special_slots: [n_special_slots][hash_size]u8, - code_slots: std.ArrayListUnmanaged([hash_size]u8) = .{}, + code_slots: std.ArrayListUnmanaged([hash_size]u8) = .empty, const n_special_slots: usize = 7; diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig index 7d00c413c2..093a202fd4 100644 --- a/src/link/MachO/DebugSymbols.zig +++ b/src/link/MachO/DebugSymbols.zig @@ -4,8 +4,8 @@ file: fs.File, symtab_cmd: macho.symtab_command = .{}, uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 }, -segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, -sections: std.ArrayListUnmanaged(macho.section_64) = .{}, +segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, +sections: std.ArrayListUnmanaged(macho.section_64) = .empty, dwarf_segment_cmd_index: ?u8 = null, linkedit_segment_cmd_index: ?u8 = null, @@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null, debug_loclists_section_index: ?u8 = null, debug_rnglists_section_index: ?u8 = null, -relocs: std.ArrayListUnmanaged(Reloc) = .{}, +relocs: std.ArrayListUnmanaged(Reloc) = .empty, /// Output synthetic sections -symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, pub const Reloc = struct { type: enum { diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index f5ed166ee0..9852cfb234 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -6,15 +6,15 @@ file_handle: File.HandleIndex, tag: enum { dylib, tbd }, exports: std.MultiArrayList(Export) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +strtab: std.ArrayListUnmanaged(u8) = .empty, id: ?Id = null, ordinal: u16 = 0, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, -dependents: std.ArrayListUnmanaged(Id) = .{}, -rpaths: std.StringArrayHashMapUnmanaged(void) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, +dependents: std.ArrayListUnmanaged(Id) = .empty, +rpaths: std.StringArrayHashMapUnmanaged(void) = .empty, umbrella: File.Index, platform: ?MachO.Platform = null, @@ -742,7 +742,7 @@ pub const TargetMatcher = struct { allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM, - target_strings: std.ArrayListUnmanaged([]const u8) = .{}, + target_strings: std.ArrayListUnmanaged([]const u8) = .empty, pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher { var self = TargetMatcher{ diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig index 4054429ef8..ed7a05b023 100644 --- a/src/link/MachO/InternalObject.zig +++ b/src/link/MachO/InternalObject.zig @@ -1,19 +1,19 @@ index: File.Index, sections: std.MultiArrayList(Section) = .{}, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, -symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, +symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, -objc_methnames: std.ArrayListUnmanaged(u8) = .{}, +objc_methnames: std.ArrayListUnmanaged(u8) = .empty, objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64), -force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .{}, +force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .empty, entry_index: ?Symbol.Index = null, dyld_stub_binder_index: ?Symbol.Index = null, dyld_private_index: ?Symbol.Index = null, @@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null, mh_execute_header_index: ?Symbol.Index = null, mh_dylib_header_index: ?Symbol.Index = null, dso_handle_index: ?Symbol.Index = null, -boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, +boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, output_symtab_ctx: MachO.SymtabCtx = .{}, @@ -849,7 +849,7 @@ fn formatSymtab( const Section = struct { header: macho.section_64, - relocs: std.ArrayListUnmanaged(Relocation) = .{}, + relocs: std.ArrayListUnmanaged(Relocation) = .empty, extra: Extra = .{}, const Extra = packed struct { diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index 4d2662a838..81f28de65a 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -9,27 +9,27 @@ in_archive: ?InArchive = null, header: ?macho.mach_header_64 = null, sections: std.MultiArrayList(Section) = .{}, symtab: std.MultiArrayList(Nlist) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +strtab: std.ArrayListUnmanaged(u8) = .empty, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, platform: ?MachO.Platform = null, compile_unit: ?CompileUnit = null, -stab_files: std.ArrayListUnmanaged(StabFile) = .{}, +stab_files: std.ArrayListUnmanaged(StabFile) = .empty, eh_frame_sect_index: ?u8 = null, compact_unwind_sect_index: ?u8 = null, -cies: std.ArrayListUnmanaged(Cie) = .{}, -fdes: std.ArrayListUnmanaged(Fde) = .{}, -eh_frame_data: std.ArrayListUnmanaged(u8) = .{}, -unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .{}, -unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .{}, -data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .{}, +cies: std.ArrayListUnmanaged(Cie) = .empty, +fdes: std.ArrayListUnmanaged(Fde) = .empty, +eh_frame_data: std.ArrayListUnmanaged(u8) = .empty, +unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .empty, +unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .empty, +data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .empty, alive: bool = true, hidden: bool = false, @@ -2675,8 +2675,8 @@ fn formatPath( const Section = struct { header: macho.section_64, - subsections: std.ArrayListUnmanaged(Subsection) = .{}, - relocs: std.ArrayListUnmanaged(Relocation) = .{}, + subsections: std.ArrayListUnmanaged(Subsection) = .empty, + relocs: std.ArrayListUnmanaged(Relocation) = .empty, }; const Subsection = struct { @@ -2692,7 +2692,7 @@ pub const Nlist = struct { const StabFile = struct { comp_dir: u32, - stabs: std.ArrayListUnmanaged(Stab) = .{}, + stabs: std.ArrayListUnmanaged(Stab) = .empty, fn getCompDir(sf: StabFile, object: Object) [:0]const u8 { const nlist = object.symtab.items(.nlist)[sf.comp_dir]; diff --git a/src/link/MachO/Thunk.zig b/src/link/MachO/Thunk.zig index 4a76a408ed..d720d4fd25 100644 --- a/src/link/MachO/Thunk.zig +++ b/src/link/MachO/Thunk.zig @@ -1,6 +1,6 @@ value: u64 = 0, out_n_sect: u8 = 0, -symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .{}, +symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .empty, output_symtab_ctx: MachO.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/link/MachO/UnwindInfo.zig b/src/link/MachO/UnwindInfo.zig index 42172b8518..cf8a49bed1 100644 --- a/src/link/MachO/UnwindInfo.zig +++ b/src/link/MachO/UnwindInfo.zig @@ -1,6 +1,6 @@ /// List of all unwind records gathered from all objects and sorted /// by allocated relative function address within the section. -records: std.ArrayListUnmanaged(Record.Ref) = .{}, +records: std.ArrayListUnmanaged(Record.Ref) = .empty, /// List of all personalities referenced by either unwind info entries /// or __eh_frame entries. @@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined, common_encodings_count: u7 = 0, /// List of record indexes containing an LSDA pointer. -lsdas: std.ArrayListUnmanaged(u32) = .{}, -lsdas_lookup: std.ArrayListUnmanaged(u32) = .{}, +lsdas: std.ArrayListUnmanaged(u32) = .empty, +lsdas_lookup: std.ArrayListUnmanaged(u32) = .empty, /// List of second level pages. -pages: std.ArrayListUnmanaged(Page) = .{}, +pages: std.ArrayListUnmanaged(Page) = .empty, pub fn deinit(info: *UnwindInfo, allocator: Allocator) void { info.records.deinit(allocator); diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 3ffa9c4745..a2d578845c 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -1,4 +1,4 @@ -data: std.ArrayListUnmanaged(u8) = .{}, +data: std.ArrayListUnmanaged(u8) = .empty, /// Externally owned memory. path: []const u8, index: File.Index, @@ -6,15 +6,15 @@ index: File.Index, symtab: std.MultiArrayList(Nlist) = .{}, strtab: StringTable = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, /// Maps string index (so name) into nlist index for the global symbol defined within this /// module. -globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .{}, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, +globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .empty, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, /// Table of tracked LazySymbols. lazy_syms: LazySymbolTable = .{}, @@ -1786,7 +1786,7 @@ fn formatAtoms( const AvMetadata = struct { symbol_index: Symbol.Index, /// A list of all exports aliases of this Av. - exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, + exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 { for (m.exports.items) |*exp| { diff --git a/src/link/MachO/dyld_info/Rebase.zig b/src/link/MachO/dyld_info/Rebase.zig index 2bee8ad22c..cbd0461431 100644 --- a/src/link/MachO/dyld_info/Rebase.zig +++ b/src/link/MachO/dyld_info/Rebase.zig @@ -1,5 +1,5 @@ -entries: std.ArrayListUnmanaged(Entry) = .{}, -buffer: std.ArrayListUnmanaged(u8) = .{}, +entries: std.ArrayListUnmanaged(Entry) = .empty, +buffer: std.ArrayListUnmanaged(u8) = .empty, pub const Entry = struct { offset: u64, diff --git a/src/link/MachO/dyld_info/Trie.zig b/src/link/MachO/dyld_info/Trie.zig index aed7b61df8..b45651eb67 100644 --- a/src/link/MachO/dyld_info/Trie.zig +++ b/src/link/MachO/dyld_info/Trie.zig @@ -31,9 +31,9 @@ /// The root node of the trie. root: ?Node.Index = null, -buffer: std.ArrayListUnmanaged(u8) = .{}, +buffer: std.ArrayListUnmanaged(u8) = .empty, nodes: std.MultiArrayList(Node) = .{}, -edges: std.ArrayListUnmanaged(Edge) = .{}, +edges: std.ArrayListUnmanaged(Edge) = .empty, /// Insert a symbol into the trie, updating the prefixes in the process. /// This operation may change the layout of the trie by splicing edges in @@ -317,7 +317,7 @@ const Node = struct { trie_offset: u32 = 0, /// List of all edges originating from this node. - edges: std.ArrayListUnmanaged(Edge.Index) = .{}, + edges: std.ArrayListUnmanaged(Edge.Index) = .empty, const Index = u32; }; diff --git a/src/link/MachO/dyld_info/bind.zig b/src/link/MachO/dyld_info/bind.zig index 310118af41..328d6a402c 100644 --- a/src/link/MachO/dyld_info/bind.zig +++ b/src/link/MachO/dyld_info/bind.zig @@ -17,8 +17,8 @@ pub const Entry = struct { }; pub const Bind = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - buffer: std.ArrayListUnmanaged(u8) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + buffer: std.ArrayListUnmanaged(u8) = .empty, const Self = @This(); @@ -269,8 +269,8 @@ pub const Bind = struct { }; pub const WeakBind = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - buffer: std.ArrayListUnmanaged(u8) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + buffer: std.ArrayListUnmanaged(u8) = .empty, const Self = @This(); @@ -511,9 +511,9 @@ pub const WeakBind = struct { }; pub const LazyBind = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - buffer: std.ArrayListUnmanaged(u8) = .{}, - offsets: std.ArrayListUnmanaged(u32) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + buffer: std.ArrayListUnmanaged(u8) = .empty, + offsets: std.ArrayListUnmanaged(u32) = .empty, const Self = @This(); diff --git a/src/link/MachO/synthetic.zig b/src/link/MachO/synthetic.zig index 5c7ede387d..900316a769 100644 --- a/src/link/MachO/synthetic.zig +++ b/src/link/MachO/synthetic.zig @@ -1,5 +1,5 @@ pub const GotSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub const Index = u32; @@ -68,7 +68,7 @@ pub const GotSection = struct { }; pub const StubsSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub const Index = u32; @@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct { }; pub const TlvPtrSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub const Index = u32; @@ -388,7 +388,7 @@ pub const TlvPtrSection = struct { }; pub const ObjcStubsSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void { objc.symbols.deinit(allocator); @@ -548,7 +548,7 @@ pub const Indsymtab = struct { }; pub const DataInCode = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, pub fn deinit(dice: *DataInCode, allocator: Allocator) void { dice.entries.deinit(allocator); diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index 7737c22d05..413ab7372a 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -34,13 +34,13 @@ bases: Bases, /// Does not represent the order or amount of symbols in the file /// it is just useful for storing symbols. Some other symbols are in /// file_segments. -syms: std.ArrayListUnmanaged(aout.Sym) = .{}, +syms: std.ArrayListUnmanaged(aout.Sym) = .empty, /// The plan9 a.out format requires segments of /// filenames to be deduplicated, so we use this map to /// de duplicate it. The value is the value of the path /// component -file_segments: std.StringArrayHashMapUnmanaged(u16) = .{}, +file_segments: std.StringArrayHashMapUnmanaged(u16) = .empty, /// The value of a 'f' symbol increments by 1 every time, so that no 2 'f' /// symbols have the same value. file_segments_i: u16 = 1, @@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator, /// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place) fn_nav_table: std.AutoArrayHashMapUnmanaged( Zcu.File.Index, - struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .{} }, + struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .empty }, ) = .{}, /// the code is modified when relocated, so that is why it is mutable -data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .{}, +data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .empty, /// When `updateExports` is called, we store the export indices here, to be used /// during flush. -nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .{}, +nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .empty, lazy_syms: LazySymbolTable = .{}, -uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .{}, +uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty, -relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .{}, +relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .empty, hdr: aout.ExecHdr = undefined, // relocs: std. @@ -77,12 +77,12 @@ entry_val: ?u64 = null, got_len: usize = 0, // A list of all the free got indexes, so when making a new decl // don't make a new one, just use one from here. -got_index_free_list: std.ArrayListUnmanaged(usize) = .{}, +got_index_free_list: std.ArrayListUnmanaged(usize) = .empty, -syms_index_free_list: std.ArrayListUnmanaged(usize) = .{}, +syms_index_free_list: std.ArrayListUnmanaged(usize) = .empty, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .empty, /// Indices of the three "special" symbols into atoms etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null }, @@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct { const NavMetadata = struct { index: Atom.Index, - exports: std.ArrayListUnmanaged(usize) = .{}, + exports: std.ArrayListUnmanaged(usize) = .empty, fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize { for (m.exports.items) |exp| { diff --git a/src/link/SpirV/BinaryModule.zig b/src/link/SpirV/BinaryModule.zig index 648e55f2ca..c80bf9b06a 100644 --- a/src/link/SpirV/BinaryModule.zig +++ b/src/link/SpirV/BinaryModule.zig @@ -148,7 +148,7 @@ pub const Parser = struct { a: Allocator, /// Maps (instruction set, opcode) => instruction index (for instruction set) - opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .{}, + opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .empty, pub fn init(a: Allocator) !Parser { var self = Parser{ diff --git a/src/link/SpirV/deduplicate.zig b/src/link/SpirV/deduplicate.zig index 292ff0e868..f639644f7b 100644 --- a/src/link/SpirV/deduplicate.zig +++ b/src/link/SpirV/deduplicate.zig @@ -178,8 +178,8 @@ const ModuleInfo = struct { const EntityContext = struct { a: Allocator, - ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{}, - ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{}, + ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty, + ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty, info: *const ModuleInfo, binary: *const BinaryModule, diff --git a/src/link/SpirV/lower_invocation_globals.zig b/src/link/SpirV/lower_invocation_globals.zig index 111ec2621b..a06a868e18 100644 --- a/src/link/SpirV/lower_invocation_globals.zig +++ b/src/link/SpirV/lower_invocation_globals.zig @@ -342,9 +342,9 @@ 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) = .{}, + function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .empty, /// Maps functions to new information required for creating the module - function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .{}, + function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .empty, /// Offset of the functions section in the new binary. new_functions_section: ?usize, diff --git a/src/link/StringTable.zig b/src/link/StringTable.zig index 2375bf4449..b03e025ff0 100644 --- a/src/link/StringTable.zig +++ b/src/link/StringTable.zig @@ -1,5 +1,5 @@ -buffer: std.ArrayListUnmanaged(u8) = .{}, -table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, +buffer: std.ArrayListUnmanaged(u8) = .empty, +table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, pub fn deinit(self: *Self, gpa: Allocator) void { self.buffer.deinit(gpa); diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 23425a2e7c..7d97fb4c7d 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{}, /// TODO: Allow setting this through a flag? host_name: []const u8 = "env", /// List of symbols generated by the linker. -synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .{}, +synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .empty, /// Maps atoms to their segment index -atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{}, +atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty, /// List of all atoms. -managed_atoms: std.ArrayListUnmanaged(Atom) = .{}, +managed_atoms: std.ArrayListUnmanaged(Atom) = .empty, /// Represents the index into `segments` where the 'code' section /// lives. code_section_index: ?u32 = null, @@ -106,22 +106,22 @@ imported_globals_count: u32 = 0, /// to the table indexes when sections are merged. imported_tables_count: u32 = 0, /// Map of symbol locations, represented by its `types.Import` -imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .{}, +imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .empty, /// Represents non-synthetic section entries. /// Used for code, data and custom sections. -segments: std.ArrayListUnmanaged(Segment) = .{}, +segments: std.ArrayListUnmanaged(Segment) = .empty, /// Maps a data segment key (such as .rodata) to the index into `segments`. -data_segments: std.StringArrayHashMapUnmanaged(u32) = .{}, +data_segments: std.StringArrayHashMapUnmanaged(u32) = .empty, /// A table of `types.Segment` which provide meta data /// about a data symbol such as its name where the key is /// the segment index, which can be found from `data_segments` -segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .{}, +segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .empty, /// Deduplicated string table for strings used by symbols, imports and exports. string_table: StringTable = .{}, // Output sections /// Output type section -func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{}, +func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty, /// Output function section where the key is the original /// function index and the value is function. /// This allows us to map multiple symbols to the same function. @@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged( struct { func: std.wasm.Func, sym_index: Symbol.Index }, ) = .{}, /// Output global section -wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .{}, +wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty, /// Memory section memories: std.wasm.Memory = .{ .limits = .{ .min = 0, @@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{ .flags = 0, } }, /// Output table section -tables: std.ArrayListUnmanaged(std.wasm.Table) = .{}, +tables: std.ArrayListUnmanaged(std.wasm.Table) = .empty, /// Output export section -exports: std.ArrayListUnmanaged(types.Export) = .{}, +exports: std.ArrayListUnmanaged(types.Export) = .empty, /// List of initialization functions. These must be called in order of priority /// by the (synthetic) __wasm_call_ctors function. -init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .{}, +init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .empty, /// Index to a function defining the entry of the wasm file entry: ?u32 = null, @@ -152,31 +152,31 @@ entry: ?u32 = null, /// as well as an 'elements' section. /// /// Note: Key is symbol location, value represents the index into the table -function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .{}, +function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .empty, /// All object files and their data which are linked into the final binary -objects: std.ArrayListUnmanaged(File.Index) = .{}, +objects: std.ArrayListUnmanaged(File.Index) = .empty, /// All archive files that are lazy loaded. /// e.g. when an undefined symbol references a symbol from the archive. -archives: std.ArrayListUnmanaged(Archive) = .{}, +archives: std.ArrayListUnmanaged(Archive) = .empty, /// A map of global names (read: offset into string table) to their symbol location -globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .{}, +globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .empty, /// The list of GOT symbols and their location -got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .{}, +got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .empty, /// Maps discarded symbols and their positions to the location of the symbol /// it was resolved to -discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .{}, +discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .empty, /// List of all symbol locations which have been resolved by the linker and will be emit /// into the final binary. -resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .{}, +resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .empty, /// Symbols that remain undefined after symbol resolution. /// Note: The key represents an offset into the string table, rather than the actual string. -undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .{}, +undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .empty, /// Maps a symbol's location to an atom. This can be used to find meta /// data of a symbol, such as its size, or its offset to perform a relocation. /// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped. -symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .{}, +symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .empty, pub const Alignment = types.Alignment; @@ -287,7 +287,7 @@ pub const StringTable = struct { std.hash_map.default_max_load_percentage, ) = .{}, /// Holds the actual data of the string table. - string_data: std.ArrayListUnmanaged(u8) = .{}, + string_data: std.ArrayListUnmanaged(u8) = .empty, /// Accepts a string and searches for a corresponding string. /// When found, de-duplicates the string and returns the existing offset instead. @@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void { fn sortDataSegments(wasm: *Wasm) !void { const gpa = wasm.base.comp.gpa; - var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .{}; + var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .empty; try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count()); errdefer new_mapping.deinit(gpa); diff --git a/src/link/Wasm/Archive.zig b/src/link/Wasm/Archive.zig index e069aeef8c..c7e5c7caba 100644 --- a/src/link/Wasm/Archive.zig +++ b/src/link/Wasm/Archive.zig @@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined, /// Parsed table of contents. /// Each symbol name points to a list of all definition /// sites within the current static archive. -toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .{}, +toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .empty, // Archive files start with the ARMAG identifying string. Then follows a // `struct ar_hdr', and as many bytes of member file data as its `ar_size' diff --git a/src/link/Wasm/Atom.zig b/src/link/Wasm/Atom.zig index e5ad4ee161..dd373552d5 100644 --- a/src/link/Wasm/Atom.zig +++ b/src/link/Wasm/Atom.zig @@ -6,9 +6,9 @@ sym_index: Symbol.Index, /// Size of the atom, used to calculate section sizes in the final binary size: u32 = 0, /// List of relocations belonging to this atom -relocs: std.ArrayListUnmanaged(types.Relocation) = .{}, +relocs: std.ArrayListUnmanaged(types.Relocation) = .empty, /// Contains the binary data of an atom, which can be non-relocated -code: std.ArrayListUnmanaged(u8) = .{}, +code: std.ArrayListUnmanaged(u8) = .empty, /// For code this is 1, for data this is set to the highest value of all segments alignment: Wasm.Alignment = .@"1", /// Offset into the section where the atom lives, this already accounts @@ -22,7 +22,7 @@ original_offset: u32 = 0, prev: Atom.Index = .null, /// Contains atoms local to a decl, all managed by this `Atom`. /// When the parent atom is being freed, it will also do so for all local atoms. -locals: std.ArrayListUnmanaged(Atom.Index) = .{}, +locals: std.ArrayListUnmanaged(Atom.Index) = .empty, /// Represents the index of an Atom where `null` is considered /// an invalid atom. diff --git a/src/link/Wasm/Object.zig b/src/link/Wasm/Object.zig index fa46a1fea4..81a3cac737 100644 --- a/src/link/Wasm/Object.zig +++ b/src/link/Wasm/Object.zig @@ -51,7 +51,7 @@ start: ?u32 = null, features: []const types.Feature = &.{}, /// A table that maps the relocations we must perform where the key represents /// the section that the list of relocations applies to. -relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .{}, +relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .empty, /// Table of symbols belonging to this Object file symtable: []Symbol = &.{}, /// Extra metadata about the linking section, such as alignment of segments and their name @@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{}, comdat_info: []const types.Comdat = &.{}, /// Represents non-synthetic sections that can essentially be mem-cpy'd into place /// after performing relocations. -relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .{}, +relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .empty, /// String table for all strings required by the object file, such as symbol names, /// import name, module name and export names. Each string will be deduplicated /// and returns an offset into the table. @@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type { try parser.parseFeatures(gpa); } else if (std.mem.startsWith(u8, name, ".debug")) { const gop = try parser.object.relocatable_data.getOrPut(gpa, .custom); - var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .{}; + var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .empty; defer relocatable_data.deinit(gpa); if (!gop.found_existing) { gop.value_ptr.* = &.{}; diff --git a/src/link/Wasm/ZigObject.zig b/src/link/Wasm/ZigObject.zig index afb0216fd7..962024eeef 100644 --- a/src/link/Wasm/ZigObject.zig +++ b/src/link/Wasm/ZigObject.zig @@ -8,37 +8,37 @@ path: []const u8, index: File.Index, /// Map of all `Nav` that are currently alive. /// Each index maps to the corresponding `NavInfo`. -navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .{}, +navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .empty, /// List of function type signatures for this Zig module. -func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{}, +func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty, /// List of `std.wasm.Func`. Each entry contains the function signature, /// rather than the actual body. -functions: std.ArrayListUnmanaged(std.wasm.Func) = .{}, +functions: std.ArrayListUnmanaged(std.wasm.Func) = .empty, /// List of indexes pointing to an entry within the `functions` list which has been removed. -functions_free_list: std.ArrayListUnmanaged(u32) = .{}, +functions_free_list: std.ArrayListUnmanaged(u32) = .empty, /// Map of symbol locations, represented by its `types.Import`. -imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .{}, +imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .empty, /// List of WebAssembly globals. -globals: std.ArrayListUnmanaged(std.wasm.Global) = .{}, +globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty, /// Mapping between an `Atom` and its type index representing the Wasm /// type of the function signature. -atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .{}, +atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .empty, /// List of all symbols generated by Zig code. -symbols: std.ArrayListUnmanaged(Symbol) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, /// Map from symbol name offset to their index into the `symbols` list. -global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{}, +global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty, /// List of symbol indexes which are free to be used. -symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .{}, +symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .empty, /// Extra metadata about the linking section, such as alignment of segments and their name. -segment_info: std.ArrayListUnmanaged(types.Segment) = .{}, +segment_info: std.ArrayListUnmanaged(types.Segment) = .empty, /// List of indexes which contain a free slot in the `segment_info` list. -segment_free_list: std.ArrayListUnmanaged(u32) = .{}, +segment_free_list: std.ArrayListUnmanaged(u32) = .empty, /// File encapsulated string table, used to deduplicate strings within the generated file. string_table: StringTable = .{}, /// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index. -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .{}, +uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty, /// List of atom indexes of functions that are generated by the backend. -synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .{}, +synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .empty, /// Represents the symbol index of the error name table /// When this is `null`, no code references an error using runtime `@errorName`. /// During initializion, a symbol with corresponding atom will be created that is @@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null, const NavInfo = struct { atom: Atom.Index = .null, - exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, + exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index { for (ni.exports.items) |sym_index| { diff --git a/src/link/table_section.zig b/src/link/table_section.zig index 2c70b03f42..f3762b38dd 100644 --- a/src/link/table_section.zig +++ b/src/link/table_section.zig @@ -1,8 +1,8 @@ pub fn TableSection(comptime Entry: type) type { return struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - free_list: std.ArrayListUnmanaged(Index) = .{}, - lookup: std.AutoHashMapUnmanaged(Entry, Index) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + free_list: std.ArrayListUnmanaged(Index) = .empty, + lookup: std.AutoHashMapUnmanaged(Entry, Index) = .empty, pub fn deinit(self: *Self, allocator: Allocator) void { self.entries.deinit(allocator); diff --git a/src/link/tapi/parse.zig b/src/link/tapi/parse.zig index deba9aaef0..f6556dd5dd 100644 --- a/src/link/tapi/parse.zig +++ b/src/link/tapi/parse.zig @@ -115,7 +115,7 @@ pub const Node = struct { .start = undefined, .end = undefined, }, - values: std.ArrayListUnmanaged(Entry) = .{}, + values: std.ArrayListUnmanaged(Entry) = .empty, pub const base_tag: Node.Tag = .map; @@ -161,7 +161,7 @@ pub const Node = struct { .start = undefined, .end = undefined, }, - values: std.ArrayListUnmanaged(*Node) = .{}, + values: std.ArrayListUnmanaged(*Node) = .empty, pub const base_tag: Node.Tag = .list; @@ -195,7 +195,7 @@ pub const Node = struct { .start = undefined, .end = undefined, }, - string_value: std.ArrayListUnmanaged(u8) = .{}, + string_value: std.ArrayListUnmanaged(u8) = .empty, pub const base_tag: Node.Tag = .value; @@ -227,7 +227,7 @@ pub const Tree = struct { source: []const u8, tokens: []Token, line_cols: std.AutoHashMap(TokenIndex, LineCol), - docs: std.ArrayListUnmanaged(*Node) = .{}, + docs: std.ArrayListUnmanaged(*Node) = .empty, pub fn init(allocator: Allocator) Tree { return .{ diff --git a/src/main.zig b/src/main.zig index 0e7a801b46..4a7f477106 100644 --- a/src/main.zig +++ b/src/main.zig @@ -126,7 +126,7 @@ const debug_usage = normal_usage ++ const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage; const default_local_zig_cache_basename = ".zig-cache"; -var log_scopes: std.ArrayListUnmanaged([]const u8) = .{}; +var log_scopes: std.ArrayListUnmanaged([]const u8) = .empty; pub fn log( comptime level: std.log.Level, @@ -895,14 +895,14 @@ fn buildOutputType( var linker_module_definition_file: ?[]const u8 = null; var test_no_exec = false; var entry: Compilation.CreateOptions.Entry = .default; - var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}; + var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty; var stack_size: ?u64 = null; var image_base: ?u64 = null; var link_eh_frame_hdr = false; var link_emit_relocs = false; var build_id: ?std.zig.BuildId = null; var runtime_args_start: ?usize = null; - var test_filters: std.ArrayListUnmanaged([]const u8) = .{}; + var test_filters: std.ArrayListUnmanaged([]const u8) = .empty; var test_name_prefix: ?[]const u8 = null; var test_runner_path: ?[]const u8 = null; var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena); @@ -931,12 +931,12 @@ fn buildOutputType( var pdb_out_path: ?[]const u8 = null; var error_limit: ?Zcu.ErrorInt = null; // These are before resolving sysroot. - var extra_cflags: std.ArrayListUnmanaged([]const u8) = .{}; - var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .{}; - var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{}; + var extra_cflags: std.ArrayListUnmanaged([]const u8) = .empty; + var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .empty; + var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty; var rc_includes: Compilation.RcIncludes = .any; var manifest_file: ?[]const u8 = null; - var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .{}; + var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .empty; // Tracks the position in c_source_files which have already their owner populated. var c_source_files_owner_index: usize = 0; @@ -944,7 +944,7 @@ fn buildOutputType( var rc_source_files_owner_index: usize = 0; // null means replace with the test executable binary - var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .{}; + var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .empty; // These get set by CLI flags and then snapshotted when a `-M` flag is // encountered. @@ -953,8 +953,8 @@ fn buildOutputType( // These get appended to by CLI flags and then slurped when a `-M` flag // is encountered. var cssan: ClangSearchSanitizer = .{}; - var cc_argv: std.ArrayListUnmanaged([]const u8) = .{}; - var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{}; + var cc_argv: std.ArrayListUnmanaged([]const u8) = .empty; + var deps: std.ArrayListUnmanaged(CliModule.Dep) = .empty; // Contains every module specified via -M. The dependencies are added // after argument parsing is completed. We use a StringArrayHashMap to make @@ -2806,7 +2806,7 @@ fn buildOutputType( create_module.opts.emit_bin = emit_bin != .no; create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0; - var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .{}; + var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .empty; // `builtin_modules` allocated into `arena`, so no deinit const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules); for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| { @@ -3290,7 +3290,7 @@ fn buildOutputType( process.raiseFileDescriptorLimit(); - var file_system_inputs: std.ArrayListUnmanaged(u8) = .{}; + var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty; defer file_system_inputs.deinit(gpa); const comp = Compilation.create(gpa, arena, .{ @@ -5451,7 +5451,7 @@ fn jitCmd( }); defer thread_pool.deinit(); - var child_argv: std.ArrayListUnmanaged([]const u8) = .{}; + var child_argv: std.ArrayListUnmanaged([]const u8) = .empty; try child_argv.ensureUnusedCapacity(arena, args.len + 4); // We want to release all the locks before executing the child process, so we make a nice @@ -6553,7 +6553,7 @@ fn cmdChangelist( process.exit(1); } - var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{}; + var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty; defer inst_map.deinit(gpa); try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map); @@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem { /// Silently ignore superfluous search dirs. /// Warn when a dir is added to multiple searchlists. const ClangSearchSanitizer = struct { - map: std.StringHashMapUnmanaged(Membership) = .{}, + map: std.StringHashMapUnmanaged(Membership) = .empty, fn reset(self: *@This()) void { self.map.clearRetainingCapacity(); diff --git a/src/register_manager.zig b/src/register_manager.zig index 7ca117be0c..0b569467e7 100644 --- a/src/register_manager.zig +++ b/src/register_manager.zig @@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type { return struct { allocator: Allocator, register_manager: Register.RM = .{}, - spilled: std.ArrayListUnmanaged(Register) = .{}, + spilled: std.ArrayListUnmanaged(Register) = .empty, const Self = @This(); diff --git a/src/translate_c.zig b/src/translate_c.zig index 9e974fc237..6b84aeb743 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -27,23 +27,23 @@ pub const Context = struct { gpa: mem.Allocator, arena: mem.Allocator, source_manager: *clang.SourceManager, - decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{}, + decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty, alias_list: AliasList, global_scope: *Scope.Root, clang_context: *clang.ASTContext, mangle_count: u32 = 0, /// Table of record decls that have been demoted to opaques. - opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{}, + opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty, /// Table of unnamed enums and records that are child types of typedefs. - unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{}, + unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty, /// Needed to decide if we are parsing a typename - typedefs: std.StringArrayHashMapUnmanaged(void) = .{}, + typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, /// This one is different than the root scope's name table. This contains /// 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) = .{}, + global_names: std.StringArrayHashMapUnmanaged(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. @@ -52,7 +52,7 @@ pub const Context = struct { /// 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) = .{}, + weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, pattern_list: PatternList, diff --git a/test/behavior/fn.zig b/test/behavior/fn.zig index 0066de1284..41e9f11f0b 100644 --- a/test/behavior/fn.zig +++ b/test/behavior/fn.zig @@ -415,7 +415,7 @@ test "import passed byref to function in return type" { const S = struct { fn get() @import("std").ArrayListUnmanaged(i32) { - const x: @import("std").ArrayListUnmanaged(i32) = .{}; + const x: @import("std").ArrayListUnmanaged(i32) = .empty; return x; } }; diff --git a/test/compare_output.zig b/test/compare_output.zig index d07864360f..b5c65df889 100644 --- a/test/compare_output.zig +++ b/test/compare_output.zig @@ -291,7 +291,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ stdout.print("before\n", .{}) catch unreachable; \\ defer stdout.print("defer1\n", .{}) catch unreachable; \\ defer stdout.print("defer2\n", .{}) catch unreachable; - \\ var gpa = @import("std").heap.GeneralPurposeAllocator(.{}){}; + \\ var gpa: @import("std").heap.GeneralPurposeAllocator(.{}) = .init; \\ defer _ = gpa.deinit(); \\ var arena = @import("std").heap.ArenaAllocator.init(gpa.allocator()); \\ defer arena.deinit(); @@ -361,7 +361,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const os = std.os; \\ \\pub fn main() !void { - \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; \\ defer _ = gpa.deinit(); \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator()); \\ defer arena.deinit(); @@ -402,7 +402,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const os = std.os; \\ \\pub fn main() !void { - \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; \\ defer _ = gpa.deinit(); \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator()); \\ defer arena.deinit(); diff --git a/test/standalone/coff_dwarf/main.zig b/test/standalone/coff_dwarf/main.zig index 18a7262a30..ce74876f08 100644 --- a/test/standalone/coff_dwarf/main.zig +++ b/test/standalone/coff_dwarf/main.zig @@ -5,7 +5,7 @@ const testing = std.testing; extern fn add(a: u32, b: u32, addr: *usize) u32; pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer assert(gpa.deinit() == .ok); const allocator = gpa.allocator(); diff --git a/test/standalone/empty_env/main.zig b/test/standalone/empty_env/main.zig index 37f5d6e76a..1dc435d9fa 100644 --- a/test/standalone/empty_env/main.zig +++ b/test/standalone/empty_env/main.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer _ = gpa.deinit(); const env_map = std.process.getEnvMap(gpa.allocator()) catch @panic("unable to get env map"); try std.testing.expect(env_map.count() == 0); diff --git a/test/standalone/load_dynamic_library/main.zig b/test/standalone/load_dynamic_library/main.zig index b47ea8a81f..e4466f0667 100644 --- a/test/standalone/load_dynamic_library/main.zig +++ b/test/standalone/load_dynamic_library/main.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer _ = gpa.deinit(); const args = try std.process.argsAlloc(gpa.allocator()); defer std.process.argsFree(gpa.allocator(), args); diff --git a/test/standalone/self_exe_symlink/create-symlink.zig b/test/standalone/self_exe_symlink/create-symlink.zig index e558df04d6..7bc36df8fe 100644 --- a/test/standalone/self_exe_symlink/create-symlink.zig +++ b/test/standalone/self_exe_symlink/create-symlink.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() anyerror!void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer if (gpa.deinit() == .leak) @panic("found memory leaks"); const allocator = gpa.allocator(); diff --git a/test/standalone/self_exe_symlink/main.zig b/test/standalone/self_exe_symlink/main.zig index 309db8abf0..b74c4c7f95 100644 --- a/test/standalone/self_exe_symlink/main.zig +++ b/test/standalone/self_exe_symlink/main.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer std.debug.assert(gpa.deinit() == .ok); const allocator = gpa.allocator(); diff --git a/test/standalone/simple/brace_expansion.zig b/test/standalone/simple/brace_expansion.zig index 7a769f6af7..facaf4a754 100644 --- a/test/standalone/simple/brace_expansion.zig +++ b/test/standalone/simple/brace_expansion.zig @@ -15,7 +15,7 @@ const Token = union(enum) { Eof, }; -var gpa = std.heap.GeneralPurposeAllocator(.{}){}; +var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; var global_allocator = gpa.allocator(); fn tokenize(input: []const u8) !ArrayList(Token) { diff --git a/test/standalone/windows_argv/fuzz.zig b/test/standalone/windows_argv/fuzz.zig index b45ed9fdab..4accccb3ba 100644 --- a/test/standalone/windows_argv/fuzz.zig +++ b/test/standalone/windows_argv/fuzz.zig @@ -4,7 +4,7 @@ const windows = std.os.windows; const Allocator = std.mem.Allocator; pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer std.debug.assert(gpa.deinit() == .ok); const allocator = gpa.allocator(); diff --git a/test/standalone/windows_bat_args/fuzz.zig b/test/standalone/windows_bat_args/fuzz.zig index 07370a412e..8b145ae0d2 100644 --- a/test/standalone/windows_bat_args/fuzz.zig +++ b/test/standalone/windows_bat_args/fuzz.zig @@ -3,7 +3,7 @@ const builtin = @import("builtin"); const Allocator = std.mem.Allocator; pub fn main() anyerror!void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer if (gpa.deinit() == .leak) @panic("found memory leaks"); const allocator = gpa.allocator(); diff --git a/test/standalone/windows_bat_args/test.zig b/test/standalone/windows_bat_args/test.zig index b2a9aed6ca..42df2ab94c 100644 --- a/test/standalone/windows_bat_args/test.zig +++ b/test/standalone/windows_bat_args/test.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() anyerror!void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer if (gpa.deinit() == .leak) @panic("found memory leaks"); const allocator = gpa.allocator(); diff --git a/test/standalone/windows_spawn/main.zig b/test/standalone/windows_spawn/main.zig index 4c637d36ff..9496895d61 100644 --- a/test/standalone/windows_spawn/main.zig +++ b/test/standalone/windows_spawn/main.zig @@ -3,7 +3,7 @@ const windows = std.os.windows; const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral; pub fn main() anyerror!void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer if (gpa.deinit() == .leak) @panic("found memory leaks"); const allocator = gpa.allocator(); diff --git a/tools/doctest.zig b/tools/doctest.zig index fad9be86db..070a59ee37 100644 --- a/tools/doctest.zig +++ b/tools/doctest.zig @@ -868,8 +868,8 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { var mode: std.builtin.OptimizeMode = .Debug; var link_mode: ?std.builtin.LinkMode = null; - var link_objects: std.ArrayListUnmanaged([]const u8) = .{}; - var additional_options: std.ArrayListUnmanaged([]const u8) = .{}; + var link_objects: std.ArrayListUnmanaged([]const u8) = .empty; + var additional_options: std.ArrayListUnmanaged([]const u8) = .empty; var target_str: ?[]const u8 = null; var link_libc = false; var disable_cache = false; diff --git a/tools/dump-cov.zig b/tools/dump-cov.zig index 24fc96950a..65bd19000d 100644 --- a/tools/dump-cov.zig +++ b/tools/dump-cov.zig @@ -8,7 +8,7 @@ const assert = std.debug.assert; const SeenPcsHeader = std.Build.Fuzz.abi.SeenPcsHeader; pub fn main() !void { - var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; + var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; defer _ = general_purpose_allocator.deinit(); const gpa = general_purpose_allocator.allocator(); @@ -55,7 +55,7 @@ pub fn main() !void { try stdout.print("{any}\n", .{header.*}); const pcs = header.pcAddrs(); - var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .{}; + var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .empty; try indexed_pcs.entries.resize(arena, pcs.len); @memcpy(indexed_pcs.entries.items(.key), pcs); try indexed_pcs.reIndex(arena); diff --git a/tools/generate_JSONTestSuite.zig b/tools/generate_JSONTestSuite.zig index ed3e5bd082..42dc777e82 100644 --- a/tools/generate_JSONTestSuite.zig +++ b/tools/generate_JSONTestSuite.zig @@ -3,7 +3,7 @@ const std = @import("std"); pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; var allocator = gpa.allocator(); var output = std.io.getStdOut().writer(); diff --git a/tools/generate_c_size_and_align_checks.zig b/tools/generate_c_size_and_align_checks.zig index 96874635c2..588deb4935 100644 --- a/tools/generate_c_size_and_align_checks.zig +++ b/tools/generate_c_size_and_align_checks.zig @@ -25,7 +25,7 @@ fn cName(ty: std.Target.CType) []const u8 { }; } -var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; +var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; pub fn main() !void { const gpa = general_purpose_allocator.allocator(); diff --git a/tools/incr-check.zig b/tools/incr-check.zig index a5c0afc62a..eafe6e8c04 100644 --- a/tools/incr-check.zig +++ b/tools/incr-check.zig @@ -73,7 +73,7 @@ pub fn main() !void { else null; - var child_args: std.ArrayListUnmanaged([]const u8) = .{}; + var child_args: std.ArrayListUnmanaged([]const u8) = .empty; try child_args.appendSlice(arena, &.{ resolved_zig_exe, "build-exe", @@ -107,7 +107,7 @@ pub fn main() !void { child.cwd_dir = tmp_dir; child.cwd = tmp_dir_path; - var cc_child_args: std.ArrayListUnmanaged([]const u8) = .{}; + var cc_child_args: std.ArrayListUnmanaged([]const u8) = .empty; if (emit == .c) { const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe| try std.fs.path.relative(arena, tmp_dir_path, cc_zig_exe) @@ -492,8 +492,8 @@ const Case = struct { }; fn parse(arena: Allocator, bytes: []const u8) !Case { - var updates: std.ArrayListUnmanaged(Update) = .{}; - var changes: std.ArrayListUnmanaged(FullContents) = .{}; + var updates: std.ArrayListUnmanaged(Update) = .empty; + var changes: std.ArrayListUnmanaged(FullContents) = .empty; var target_query: ?[]const u8 = null; var it = std.mem.splitScalar(u8, bytes, '\n'); var line_n: usize = 1;