authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-31 21:54:07-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-11 15:52:49-07:00
log749f10af49022597d873d41df5c600e97e5c4a37
treecb6da80d28fa284bdeb7b40d26ce8de9ca9b2306
parentd625158354a02a18e9ae7975a144f30838884d5c

std.ArrayList: make unmanaged the default


161 files changed, 861 insertions(+), 870 deletions(-)

build.zig+1-2
......@@ -3,7 +3,6 @@ const builtin = std.builtin;
33const tests = @import("test/tests.zig");
44const BufMap = std.BufMap;
55const mem = std.mem;
6const ArrayList = std.ArrayList;
76const io = std.io;
87const fs = std.fs;
98const InstallDirectoryOptions = std.Build.InstallDirectoryOptions;
......@@ -925,7 +924,7 @@ fn addCxxKnownPath(
925924 return error.RequiredLibraryNotFound;
926925
927926 const path_padded = run: {
928 var args = std.ArrayList([]const u8).init(b.allocator);
927 var args = std.array_list.Managed([]const u8).init(b.allocator);
929928 try args.append(ctx.cxx_compiler);
930929 var it = std.mem.tokenizeAny(u8, ctx.cxx_compiler_arg1, &std.ascii.whitespace);
931930 while (it.next()) |arg| try args.append(arg);
doc/langref.html.in+2-3
......@@ -6241,9 +6241,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
62416241 C has a default allocator - <code>malloc</code>, <code>realloc</code>, and <code>free</code>.
62426242 When linking against libc, Zig exposes this allocator with {#syntax#}std.heap.c_allocator{#endsyntax#}.
62436243 However, by convention, there is no default allocator in Zig. Instead, functions which need to
6244 allocate accept an {#syntax#}Allocator{#endsyntax#} parameter. Likewise, data structures such as
6245 {#syntax#}std.ArrayList{#endsyntax#} accept an {#syntax#}Allocator{#endsyntax#} parameter in
6246 their initialization functions:
6244 allocate accept an {#syntax#}Allocator{#endsyntax#} parameter. Likewise, some data structures
6245 accept an {#syntax#}Allocator{#endsyntax#} parameter in their initialization functions:
62476246 </p>
62486247 {#code|test_allocator.zig#}
62496248
doc/langref/testing_detect_leak.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33test "detect leak" {
4 var list = std.ArrayList(u21).init(std.testing.allocator);
4 var list = std.array_list.Managed(u21).init(std.testing.allocator);
55 // missing `defer list.deinit();`
66 try list.append('☔');
77
lib/compiler/aro/aro/Compilation.zig+3-3
......@@ -533,7 +533,7 @@ fn generateSystemDefines(comp: *Compilation, w: anytype) !void {
533533pub fn generateBuiltinMacros(comp: *Compilation, system_defines_mode: SystemDefinesMode) !Source {
534534 try comp.generateBuiltinTypes();
535535
536 var buf = std.ArrayList(u8).init(comp.gpa);
536 var buf = std.array_list.Managed(u8).init(comp.gpa);
537537 defer buf.deinit();
538538
539539 if (system_defines_mode == .include_system_defines) {
......@@ -1143,7 +1143,7 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, buf: []u8, path: []const u8,
11431143 const duped_path = try comp.gpa.dupe(u8, path);
11441144 errdefer comp.gpa.free(duped_path);
11451145
1146 var splice_list = std.ArrayList(u32).init(comp.gpa);
1146 var splice_list = std.array_list.Managed(u32).init(comp.gpa);
11471147 defer splice_list.deinit();
11481148
11491149 const source_id: Source.Id = @enumFromInt(comp.sources.count() + 2);
......@@ -1428,7 +1428,7 @@ fn getFileContents(comp: *Compilation, path: []const u8, limit: ?u32) ![]const u
14281428 const file = try comp.cwd.openFile(path, .{});
14291429 defer file.close();
14301430
1431 var buf = std.ArrayList(u8).init(comp.gpa);
1431 var buf = std.array_list.Managed(u8).init(comp.gpa);
14321432 defer buf.deinit();
14331433
14341434 const max = limit orelse std.math.maxInt(u32);
lib/compiler/aro/aro/Driver.zig+2-2
......@@ -590,7 +590,7 @@ var stdout_buffer: [4096]u8 = undefined;
590590/// The entry point of the Aro compiler.
591591/// **MAY call `exit` if `fast_exit` is set.**
592592pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_exit: bool) !void {
593 var macro_buf = std.ArrayList(u8).init(d.comp.gpa);
593 var macro_buf = std.array_list.Managed(u8).init(d.comp.gpa);
594594 defer macro_buf.deinit();
595595
596596 const std_out = std.fs.File.stdout().deprecatedWriter();
......@@ -817,7 +817,7 @@ fn dumpLinkerArgs(items: []const []const u8) !void {
817817/// The entry point of the Aro compiler.
818818/// **MAY call `exit` if `fast_exit` is set.**
819819pub fn invokeLinker(d: *Driver, tc: *Toolchain, comptime fast_exit: bool) !void {
820 var argv = std.ArrayList([]const u8).init(d.comp.gpa);
820 var argv = std.array_list.Managed([]const u8).init(d.comp.gpa);
821821 defer argv.deinit();
822822
823823 var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined;
lib/compiler/aro/aro/InitList.zig+1-1
......@@ -9,7 +9,7 @@ const TokenIndex = Tree.TokenIndex;
99const NodeIndex = Tree.NodeIndex;
1010const Type = @import("Type.zig");
1111const Diagnostics = @import("Diagnostics.zig");
12const NodeList = std.ArrayList(NodeIndex);
12const NodeList = std.array_list.Managed(NodeIndex);
1313const Parser = @import("Parser.zig");
1414
1515const Item = struct {
lib/compiler/aro/aro/Parser.zig+19-19
......@@ -15,7 +15,7 @@ const TokenIndex = Tree.TokenIndex;
1515const NodeIndex = Tree.NodeIndex;
1616const Type = @import("Type.zig");
1717const Diagnostics = @import("Diagnostics.zig");
18const NodeList = std.ArrayList(NodeIndex);
18const NodeList = std.array_list.Managed(NodeIndex);
1919const InitList = @import("InitList.zig");
2020const Attribute = @import("Attribute.zig");
2121const char_info = @import("char_info.zig");
......@@ -33,7 +33,7 @@ const target_util = @import("target.zig");
3333
3434const Switch = struct {
3535 default: ?TokenIndex = null,
36 ranges: std.ArrayList(Range),
36 ranges: std.array_list.Managed(Range),
3737 ty: Type,
3838 comp: *Compilation,
3939
......@@ -101,16 +101,16 @@ value_map: Tree.ValueMap,
101101
102102// buffers used during compilation
103103syms: SymbolStack = .{},
104strings: std.ArrayListAligned(u8, .@"4"),
105labels: std.ArrayList(Label),
104strings: std.array_list.AlignedManaged(u8, .@"4"),
105labels: std.array_list.Managed(Label),
106106list_buf: NodeList,
107107decl_buf: NodeList,
108param_buf: std.ArrayList(Type.Func.Param),
109enum_buf: std.ArrayList(Type.Enum.Field),
110record_buf: std.ArrayList(Type.Record.Field),
108param_buf: std.array_list.Managed(Type.Func.Param),
109enum_buf: std.array_list.Managed(Type.Enum.Field),
110record_buf: std.array_list.Managed(Type.Record.Field),
111111attr_buf: std.MultiArrayList(TentativeAttribute) = .{},
112112attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
113field_attr_buf: std.ArrayList([]const Attribute),
113field_attr_buf: std.array_list.Managed([]const Attribute),
114114/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
115115/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
116116/// The key is the StringId of `Foo` and the value is the TokenIndex of `bar`
......@@ -693,16 +693,16 @@ pub fn parse(pp: *Preprocessor) Compilation.Error!Tree {
693693 .gpa = pp.comp.gpa,
694694 .arena = arena.allocator(),
695695 .tok_ids = pp.tokens.items(.id),
696 .strings = std.ArrayListAligned(u8, .@"4").init(pp.comp.gpa),
696 .strings = std.array_list.AlignedManaged(u8, .@"4").init(pp.comp.gpa),
697697 .value_map = Tree.ValueMap.init(pp.comp.gpa),
698698 .data = NodeList.init(pp.comp.gpa),
699 .labels = std.ArrayList(Label).init(pp.comp.gpa),
699 .labels = std.array_list.Managed(Label).init(pp.comp.gpa),
700700 .list_buf = NodeList.init(pp.comp.gpa),
701701 .decl_buf = NodeList.init(pp.comp.gpa),
702 .param_buf = std.ArrayList(Type.Func.Param).init(pp.comp.gpa),
703 .enum_buf = std.ArrayList(Type.Enum.Field).init(pp.comp.gpa),
704 .record_buf = std.ArrayList(Type.Record.Field).init(pp.comp.gpa),
705 .field_attr_buf = std.ArrayList([]const Attribute).init(pp.comp.gpa),
702 .param_buf = std.array_list.Managed(Type.Func.Param).init(pp.comp.gpa),
703 .enum_buf = std.array_list.Managed(Type.Enum.Field).init(pp.comp.gpa),
704 .record_buf = std.array_list.Managed(Type.Record.Field).init(pp.comp.gpa),
705 .field_attr_buf = std.array_list.Managed([]const Attribute).init(pp.comp.gpa),
706706 .string_ids = .{
707707 .declspec_id = try StrInt.intern(pp.comp, "__declspec"),
708708 .main_id = try StrInt.intern(pp.comp, "main"),
......@@ -1222,7 +1222,7 @@ fn staticAssertMessage(p: *Parser, cond_node: NodeIndex, message: Result) !?[]co
12221222 const cond_tag = p.nodes.items(.tag)[@intFromEnum(cond_node)];
12231223 if (cond_tag != .builtin_types_compatible_p and message.node == .none) return null;
12241224
1225 var buf = std.ArrayList(u8).init(p.gpa);
1225 var buf = std.array_list.Managed(u8).init(p.gpa);
12261226 defer buf.deinit();
12271227
12281228 if (cond_tag == .builtin_types_compatible_p) {
......@@ -3994,7 +3994,7 @@ fn msvcAsmStmt(p: *Parser) Error!?NodeIndex {
39943994}
39953995
39963996/// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')'
3997fn asmOperand(p: *Parser, names: *std.ArrayList(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void {
3997fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void {
39983998 if (p.eatToken(.l_bracket)) |l_bracket| {
39993999 const ident = (try p.eatIdentifier()) orelse {
40004000 try p.err(.expected_identifier);
......@@ -4044,7 +4044,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
40444044 const allocator = stack_fallback.get();
40454045
40464046 // TODO: Consider using a TokenIndex of 0 instead of null if we need to store the names in the tree
4047 var names = std.ArrayList(?TokenIndex).initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
4047 var names = std.array_list.Managed(?TokenIndex).initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
40484048 defer names.deinit();
40494049 var constraints = NodeList.initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
40504050 defer constraints.deinit();
......@@ -4317,7 +4317,7 @@ fn stmt(p: *Parser) Error!NodeIndex {
43174317
43184318 const old_switch = p.@"switch";
43194319 var @"switch" = Switch{
4320 .ranges = std.ArrayList(Switch.Range).init(p.gpa),
4320 .ranges = std.array_list.Managed(Switch.Range).init(p.gpa),
43214321 .ty = cond.ty,
43224322 .comp = p.comp,
43234323 };
......@@ -8268,7 +8268,7 @@ fn charLiteral(p: *Parser) Error!Result {
82688268
82698269 const max_chars_expected = 4;
82708270 var stack_fallback = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), p.comp.gpa);
8271 var chars = std.ArrayList(u32).initCapacity(stack_fallback.get(), max_chars_expected) catch unreachable; // stack allocation already succeeded
8271 var chars = std.array_list.Managed(u32).initCapacity(stack_fallback.get(), max_chars_expected) catch unreachable; // stack allocation already succeeded
82728272 defer chars.deinit();
82738273
82748274 while (char_literal_parser.next()) |item| switch (item) {
lib/compiler/aro/aro/Preprocessor.zig+10-10
......@@ -17,7 +17,7 @@ const features = @import("features.zig");
1717const Hideset = @import("Hideset.zig");
1818
1919const DefineMap = std.StringHashMapUnmanaged(Macro);
20const RawTokenList = std.ArrayList(RawToken);
20const RawTokenList = std.array_list.Managed(RawToken);
2121const max_include_depth = 200;
2222
2323/// Errors that can be returned when expanding a macro.
......@@ -84,7 +84,7 @@ tokens: Token.List = .{},
8484/// Do not directly mutate this; must be kept in sync with `tokens`
8585expansion_entries: std.MultiArrayList(ExpansionEntry) = .{},
8686token_buf: RawTokenList,
87char_buf: std.ArrayList(u8),
87char_buf: std.array_list.Managed(u8),
8888/// Counter that is incremented each time preprocess() is called
8989/// Can be used to distinguish multiple preprocessings of the same file
9090preprocess_count: u32 = 0,
......@@ -131,7 +131,7 @@ pub fn init(comp: *Compilation) Preprocessor {
131131 .gpa = comp.gpa,
132132 .arena = std.heap.ArenaAllocator.init(comp.gpa),
133133 .token_buf = RawTokenList.init(comp.gpa),
134 .char_buf = std.ArrayList(u8).init(comp.gpa),
134 .char_buf = std.array_list.Managed(u8).init(comp.gpa),
135135 .poisoned_identifiers = std.StringHashMap(void).init(comp.gpa),
136136 .top_expansion_buf = ExpandBuf.init(comp.gpa),
137137 .hideset = .{ .comp = comp },
......@@ -982,7 +982,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
982982 .tok_i = @intCast(token_state.tokens_len),
983983 .arena = pp.arena.allocator(),
984984 .in_macro = true,
985 .strings = std.ArrayListAligned(u8, .@"4").init(pp.comp.gpa),
985 .strings = std.array_list.AlignedManaged(u8, .@"4").init(pp.comp.gpa),
986986
987987 .data = undefined,
988988 .value_map = undefined,
......@@ -1140,7 +1140,7 @@ fn skipToNl(tokenizer: *Tokenizer) void {
11401140 }
11411141}
11421142
1143const ExpandBuf = std.ArrayList(TokenWithExpansionLocs);
1143const ExpandBuf = std.array_list.Managed(TokenWithExpansionLocs);
11441144fn removePlacemarkers(buf: *ExpandBuf) void {
11451145 var i: usize = buf.items.len -% 1;
11461146 while (i < buf.items.len) : (i -%= 1) {
......@@ -1151,7 +1151,7 @@ fn removePlacemarkers(buf: *ExpandBuf) void {
11511151 }
11521152}
11531153
1154const MacroArguments = std.ArrayList([]const TokenWithExpansionLocs);
1154const MacroArguments = std.array_list.Managed([]const TokenWithExpansionLocs);
11551155fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void {
11561156 for (args.items) |item| {
11571157 for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, allocator);
......@@ -2075,7 +2075,7 @@ fn collectMacroFuncArguments(
20752075 var parens: u32 = 0;
20762076 var args = MacroArguments.init(pp.gpa);
20772077 errdefer deinitMacroArguments(pp.gpa, &args);
2078 var curArgument = std.ArrayList(TokenWithExpansionLocs).init(pp.gpa);
2078 var curArgument = std.array_list.Managed(TokenWithExpansionLocs).init(pp.gpa);
20792079 defer curArgument.deinit();
20802080 while (true) {
20812081 var tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf);
......@@ -2645,7 +2645,7 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
26452645/// Handle a function like #define directive.
26462646fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macro_name: RawToken, l_paren: RawToken) Error!void {
26472647 assert(macro_name.id.isMacroIdentifier());
2648 var params = std.ArrayList([]const u8).init(pp.gpa);
2648 var params = std.array_list.Managed([]const u8).init(pp.gpa);
26492649 defer params.deinit();
26502650
26512651 // Parse the parameter list.
......@@ -3471,7 +3471,7 @@ test "Preserve pragma tokens sometimes" {
34713471 const allocator = std.testing.allocator;
34723472 const Test = struct {
34733473 fn runPreprocessor(source_text: []const u8) ![]const u8 {
3474 var buf = std.ArrayList(u8).init(allocator);
3474 var buf = std.array_list.Managed(u8).init(allocator);
34753475 defer buf.deinit();
34763476
34773477 var comp = Compilation.init(allocator, std.fs.cwd());
......@@ -3602,7 +3602,7 @@ test "Include guards" {
36023602
36033603 _ = try comp.addSourceFromBuffer(path, "int bar = 5;\n");
36043604
3605 var buf = std.ArrayList(u8).init(allocator);
3605 var buf = std.array_list.Managed(u8).init(allocator);
36063606 defer buf.deinit();
36073607
36083608 var writer = buf.writer();
lib/compiler/aro/aro/Toolchain.zig+6-6
......@@ -157,7 +157,7 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 {
157157 return use_linker;
158158 }
159159 } else {
160 var linker_name = try std.ArrayList(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker
160 var linker_name = try std.array_list.Managed(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker
161161 defer linker_name.deinit();
162162 if (tc.getTarget().os.tag.isDarwin()) {
163163 linker_name.appendSliceAssumeCapacity("ld64.");
......@@ -198,7 +198,7 @@ fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8)
198198}
199199
200200/// Add toolchain `file_paths` to argv as `-L` arguments
201pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
201pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
202202 try argv.ensureUnusedCapacity(tc.file_paths.items.len);
203203
204204 var bytes_needed: usize = 0;
......@@ -332,7 +332,7 @@ pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, des
332332
333333/// Add linker args to `argv`. Does not add path to linker executable as first item; that must be handled separately
334334/// Items added to `argv` will be string literals or owned by `tc.arena` so they must not be individually freed
335pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.ArrayList([]const u8)) !void {
335pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
336336 return switch (tc.inner) {
337337 .uninitialized => unreachable,
338338 .linux => |*linux| linux.buildLinkerArgs(tc, argv),
......@@ -412,7 +412,7 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 {
412412 }
413413}
414414
415fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
415fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
416416 const unw = try tc.getUnwindLibKind();
417417 const target = tc.getTarget();
418418 if ((target.abi.isAndroid() and unw == .libgcc) or
......@@ -450,7 +450,7 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !voi
450450 }
451451}
452452
453fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
453fn addLibGCC(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
454454 const libgcc_kind = tc.getLibGCCKind();
455455 if (libgcc_kind == .static or libgcc_kind == .unspecified) {
456456 try argv.append("-lgcc");
......@@ -461,7 +461,7 @@ fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
461461 }
462462}
463463
464pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
464pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
465465 const target = tc.getTarget();
466466 const rlt = tc.getRuntimeLibKind();
467467 switch (rlt) {
lib/compiler/aro/aro/Tree.zig+1-1
......@@ -41,7 +41,7 @@ pub const TokenWithExpansionLocs = struct {
4141
4242 pub fn addExpansionLocation(tok: *TokenWithExpansionLocs, gpa: std.mem.Allocator, new: []const Source.Location) !void {
4343 if (new.len == 0 or tok.id == .whitespace or tok.id == .macro_ws or tok.id == .placemarker) return;
44 var list = std.ArrayList(Source.Location).init(gpa);
44 var list = std.array_list.Managed(Source.Location).init(gpa);
4545 defer {
4646 @memset(list.items.ptr[list.items.len..list.capacity], .{});
4747 // Add a sentinel to indicate the end of the list since
lib/compiler/aro/aro/toolchains/Linux.zig+2-2
......@@ -162,7 +162,7 @@ pub fn getDefaultLinker(self: *const Linux, target: std.Target) []const u8 {
162162 return "ld";
163163}
164164
165pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.ArrayList([]const u8)) Compilation.Error!void {
165pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) Compilation.Error!void {
166166 const d = tc.driver;
167167 const target = tc.getTarget();
168168
......@@ -465,7 +465,7 @@ test Linux {
465465
466466 try toolchain.discover();
467467
468 var argv = std.ArrayList([]const u8).init(driver.comp.gpa);
468 var argv = std.array_list.Managed([]const u8).init(driver.comp.gpa);
469469 defer argv.deinit();
470470
471471 var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined;
lib/compiler/aro/backend/Object.zig+1-1
......@@ -30,7 +30,7 @@ pub const Section = union(enum) {
3030 custom: []const u8,
3131};
3232
33pub fn getSection(obj: *Object, section: Section) !*std.ArrayList(u8) {
33pub fn getSection(obj: *Object, section: Section) !*std.array_list.Managed(u8) {
3434 switch (obj.format) {
3535 .elf => return @as(*Elf, @alignCast(@fieldParentPtr("obj", obj))).getSection(section),
3636 else => unreachable,
lib/compiler/aro/backend/Object/Elf.zig+3-3
......@@ -4,7 +4,7 @@ const Target = std.Target;
44const Object = @import("../Object.zig");
55
66const Section = struct {
7 data: std.ArrayList(u8),
7 data: std.array_list.Managed(u8),
88 relocations: std.ArrayListUnmanaged(Relocation) = .empty,
99 flags: u64,
1010 type: u32,
......@@ -80,12 +80,12 @@ fn sectionString(sec: Object.Section) []const u8 {
8080 };
8181}
8282
83pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.ArrayList(u8) {
83pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.array_list.Managed(u8) {
8484 const section_name = sectionString(section_kind);
8585 const section = elf.sections.get(section_name) orelse blk: {
8686 const section = try elf.arena.allocator().create(Section);
8787 section.* = .{
88 .data = std.ArrayList(u8).init(elf.arena.child_allocator),
88 .data = std.array_list.Managed(u8).init(elf.arena.child_allocator),
8989 .type = std.elf.SHT_PROGBITS,
9090 .flags = switch (section_kind) {
9191 .func, .custom => std.elf.SHF_ALLOC + std.elf.SHF_EXECINSTR,
lib/compiler/aro_translate_c.zig+11-11
......@@ -116,7 +116,7 @@ pub fn translate(
116116 var driver: aro.Driver = .{ .comp = comp };
117117 defer driver.deinit();
118118
119 var macro_buf = std.ArrayList(u8).init(gpa);
119 var macro_buf = std.array_list.Managed(u8).init(gpa);
120120 defer macro_buf.deinit();
121121
122122 assert(!try driver.parseArgs(std.io.null_writer, macro_buf.writer(), args));
......@@ -413,11 +413,11 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_ty: Type) Error!void {
413413 break :blk ZigTag.opaque_literal.init();
414414 }
415415
416 var fields = try std.ArrayList(ast.Payload.Record.Field).initCapacity(c.gpa, record_decl.fields.len);
416 var fields = try std.array_list.Managed(ast.Payload.Record.Field).initCapacity(c.gpa, record_decl.fields.len);
417417 defer fields.deinit();
418418
419419 // TODO: Add support for flexible array field functions
420 var functions = std.ArrayList(ZigNode).init(c.gpa);
420 var functions = std.array_list.Managed(ZigNode).init(c.gpa);
421421 defer functions.deinit();
422422
423423 var unnamed_field_count: u32 = 0;
......@@ -1234,7 +1234,7 @@ pub const PatternList = struct {
12341234 const source = template[0];
12351235 const impl = template[1];
12361236
1237 var tok_list = std.ArrayList(CToken).init(allocator);
1237 var tok_list = std.array_list.Managed(CToken).init(allocator);
12381238 defer tok_list.deinit();
12391239 try tokenizeMacro(source, &tok_list);
12401240 const tokens = try allocator.dupe(CToken, tok_list.items);
......@@ -1349,7 +1349,7 @@ pub const TypeError = Error || error{UnsupportedType};
13491349pub const TransError = TypeError || error{UnsupportedTranslation};
13501350
13511351pub const SymbolTable = std.StringArrayHashMap(ast.Node);
1352pub const AliasList = std.ArrayList(struct {
1352pub const AliasList = std.array_list.Managed(struct {
13531353 alias: []const u8,
13541354 name: []const u8,
13551355});
......@@ -1397,7 +1397,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ
13971397 /// into the main arena.
13981398 pub const Block = struct {
13991399 base: ScopeExtraScope,
1400 statements: std.ArrayList(ast.Node),
1400 statements: std.array_list.Managed(ast.Node),
14011401 variables: AliasList,
14021402 mangle_count: u32 = 0,
14031403 label: ?[]const u8 = null,
......@@ -1429,7 +1429,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ
14291429 .id = .block,
14301430 .parent = parent,
14311431 },
1432 .statements = std.ArrayList(ast.Node).init(c.gpa),
1432 .statements = std.array_list.Managed(ast.Node).init(c.gpa),
14331433 .variables = AliasList.init(c.gpa),
14341434 .variable_discards = std.StringArrayHashMap(*ast.Payload.Discard).init(c.gpa),
14351435 };
......@@ -1557,7 +1557,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ
15571557 sym_table: SymbolTable,
15581558 blank_macros: std.StringArrayHashMap(void),
15591559 context: *ScopeExtraContext,
1560 nodes: std.ArrayList(ast.Node),
1560 nodes: std.array_list.Managed(ast.Node),
15611561
15621562 pub fn init(c: *ScopeExtraContext) Root {
15631563 return .{
......@@ -1568,7 +1568,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ
15681568 .sym_table = SymbolTable.init(c.gpa),
15691569 .blank_macros = std.StringArrayHashMap(void).init(c.gpa),
15701570 .context = c,
1571 .nodes = std.ArrayList(ast.Node).init(c.gpa),
1571 .nodes = std.array_list.Managed(ast.Node).init(c.gpa),
15721572 };
15731573 }
15741574
......@@ -1705,7 +1705,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ
17051705 };
17061706}
17071707
1708pub fn tokenizeMacro(source: []const u8, tok_list: *std.ArrayList(CToken)) Error!void {
1708pub fn tokenizeMacro(source: []const u8, tok_list: *std.array_list.Managed(CToken)) Error!void {
17091709 var tokenizer: aro.Tokenizer = .{
17101710 .buf = source,
17111711 .source = .unused,
......@@ -1732,7 +1732,7 @@ test "Macro matching" {
17321732 const helper = struct {
17331733 const MacroFunctions = std.zig.c_translation.Macros;
17341734 fn checkMacro(allocator: mem.Allocator, pattern_list: PatternList, source: []const u8, comptime expected_match: ?[]const u8) !void {
1735 var tok_list = std.ArrayList(CToken).init(allocator);
1735 var tok_list = std.array_list.Managed(CToken).init(allocator);
17361736 defer tok_list.deinit();
17371737 try tokenizeMacro(source, &tok_list);
17381738 const macro_slicer: MacroSlicer = .{ .source = source, .tokens = tok_list.items };
lib/compiler/aro_translate_c/ast.zig+7-7
......@@ -763,7 +763,7 @@ pub const Payload = struct {
763763pub fn render(gpa: Allocator, nodes: []const Node) !std.zig.Ast {
764764 var ctx = Context{
765765 .gpa = gpa,
766 .buf = std.ArrayList(u8).init(gpa),
766 .buf = std.array_list.Managed(u8).init(gpa),
767767 };
768768 defer ctx.buf.deinit();
769769 defer ctx.nodes.deinit(gpa);
......@@ -787,7 +787,7 @@ pub fn render(gpa: Allocator, nodes: []const Node) !std.zig.Ast {
787787 });
788788
789789 const root_members = blk: {
790 var result = std.ArrayList(NodeIndex).init(gpa);
790 var result = std.array_list.Managed(NodeIndex).init(gpa);
791791 defer result.deinit();
792792
793793 for (nodes) |node| {
......@@ -825,7 +825,7 @@ const ExtraIndex = std.zig.Ast.ExtraIndex;
825825
826826const Context = struct {
827827 gpa: Allocator,
828 buf: std.ArrayList(u8),
828 buf: std.array_list.Managed(u8),
829829 nodes: std.zig.Ast.NodeList = .{},
830830 extra_data: std.ArrayListUnmanaged(u32) = .empty,
831831 tokens: std.zig.Ast.TokenList = .{},
......@@ -886,7 +886,7 @@ const Context = struct {
886886};
887887
888888fn renderNodes(c: *Context, nodes: []const Node) Allocator.Error!NodeSubRange {
889 var result = std.ArrayList(NodeIndex).init(c.gpa);
889 var result = std.array_list.Managed(NodeIndex).init(c.gpa);
890890 defer result.deinit();
891891
892892 for (nodes) |node| {
......@@ -1622,7 +1622,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
16221622 }
16231623 const l_brace = try c.addToken(.l_brace, "{");
16241624
1625 var stmts = std.ArrayList(NodeIndex).init(c.gpa);
1625 var stmts = std.array_list.Managed(NodeIndex).init(c.gpa);
16261626 defer stmts.deinit();
16271627 for (payload.stmts) |stmt| {
16281628 const res = try renderNode(c, stmt);
......@@ -2954,9 +2954,9 @@ fn renderMacroFunc(c: *Context, node: Node) !NodeIndex {
29542954 });
29552955}
29562956
2957fn renderParams(c: *Context, params: []Payload.Param, is_var_args: bool) !std.ArrayList(NodeIndex) {
2957fn renderParams(c: *Context, params: []Payload.Param, is_var_args: bool) !std.array_list.Managed(NodeIndex) {
29582958 _ = try c.addToken(.l_paren, "(");
2959 var rendered = try std.ArrayList(NodeIndex).initCapacity(c.gpa, params.len);
2959 var rendered = try std.array_list.Managed(NodeIndex).initCapacity(c.gpa, params.len);
29602960 errdefer rendered.deinit();
29612961
29622962 for (params, 0..) |param, i| {
lib/compiler/build_runner.zig+2-3
......@@ -5,7 +5,6 @@ const io = std.io;
55const fmt = std.fmt;
66const mem = std.mem;
77const process = std.process;
8const ArrayList = std.ArrayList;
98const File = std.fs.File;
109const Step = std.Build.Step;
1110const Watch = std.Build.Watch;
......@@ -98,8 +97,8 @@ pub fn main() !void {
9897 dependencies.root_deps,
9998 );
10099
101 var targets = ArrayList([]const u8).init(arena);
102 var debug_log_scopes = ArrayList([]const u8).init(arena);
100 var targets = std.array_list.Managed([]const u8).init(arena);
101 var debug_log_scopes = std.array_list.Managed([]const u8).init(arena);
103102 var thread_pool_options: std.Thread.Pool.Options = .{ .allocator = arena };
104103
105104 var install_prefix: ?[]const u8 = null;
lib/compiler/reduce.zig+4-4
......@@ -114,10 +114,10 @@ pub fn main() !void {
114114 interestingness_argv.appendAssumeCapacity(checker_path);
115115 interestingness_argv.appendSliceAssumeCapacity(argv);
116116
117 var rendered = std.ArrayList(u8).init(gpa);
117 var rendered = std.array_list.Managed(u8).init(gpa);
118118 defer rendered.deinit();
119119
120 var astgen_input = std.ArrayList(u8).init(gpa);
120 var astgen_input = std.array_list.Managed(u8).init(gpa);
121121 defer astgen_input.deinit();
122122
123123 var tree = try parse(gpa, root_source_file_path);
......@@ -161,7 +161,7 @@ pub fn main() !void {
161161 // result, restart the whole process, reparsing the AST and re-generating the list
162162 // of all possible transformations and shuffling it again.
163163
164 var transformations = std.ArrayList(Walk.Transformation).init(gpa);
164 var transformations = std.array_list.Managed(Walk.Transformation).init(gpa);
165165 defer transformations.deinit();
166166 try Walk.findTransformations(arena, &tree, &transformations);
167167 sortTransformations(transformations.items, rng.random());
......@@ -382,7 +382,7 @@ fn transformationsToFixups(
382382 }
383383 }
384384
385 var other_source = std.ArrayList(u8).init(gpa);
385 var other_source = std.array_list.Managed(u8).init(gpa);
386386 defer other_source.deinit();
387387 try other_source.appendSlice("struct {\n");
388388 try other_file_ast.renderToArrayList(&other_source, inlined_fixups);
lib/compiler/reduce/Walk.zig+2-2
......@@ -5,7 +5,7 @@ const assert = std.debug.assert;
55const BuiltinFn = std.zig.BuiltinFn;
66
77ast: *const Ast,
8transformations: *std.ArrayList(Transformation),
8transformations: *std.array_list.Managed(Transformation),
99unreferenced_globals: std.StringArrayHashMapUnmanaged(Ast.Node.Index),
1010in_scope_names: std.StringArrayHashMapUnmanaged(u32),
1111replace_names: std.StringArrayHashMapUnmanaged(u32),
......@@ -54,7 +54,7 @@ pub const Error = error{OutOfMemory};
5454pub fn findTransformations(
5555 arena: std.mem.Allocator,
5656 ast: *const Ast,
57 transformations: *std.ArrayList(Transformation),
57 transformations: *std.array_list.Managed(Transformation),
5858) !void {
5959 transformations.clearRetainingCapacity();
6060
lib/compiler/resinator/cli.zig+1-1
......@@ -1291,7 +1291,7 @@ pub fn parse(allocator: Allocator, args: []const []const u8, diagnostics: *Diagn
12911291}
12921292
12931293pub fn filepathWithExtension(allocator: Allocator, path: []const u8, ext: []const u8) ![]const u8 {
1294 var buf = std.ArrayList(u8).init(allocator);
1294 var buf = std.array_list.Managed(u8).init(allocator);
12951295 errdefer buf.deinit();
12961296 if (std.fs.path.dirname(path)) |dirname| {
12971297 var end_pos = dirname.len;
lib/compiler/resinator/compile.zig+15-15
......@@ -38,7 +38,7 @@ pub const CompileOptions = struct {
3838 /// Items within the list will be allocated using the allocator of the ArrayList and must be
3939 /// freed by the caller.
4040 /// TODO: Maybe a dedicated struct for this purpose so that it's a bit nicer to work with.
41 dependencies_list: ?*std.ArrayList([]const u8) = null,
41 dependencies_list: ?*std.array_list.Managed([]const u8) = null,
4242 default_code_page: SupportedCodePage = .windows1252,
4343 /// If true, the first #pragma code_page directive only sets the input code page, but not the output code page.
4444 /// This check must be done before comments are removed from the file.
......@@ -74,7 +74,7 @@ pub fn compile(allocator: Allocator, source: []const u8, writer: anytype, option
7474 var tree = try parser.parse(allocator, options.diagnostics);
7575 defer tree.deinit();
7676
77 var search_dirs = std.ArrayList(SearchDir).init(allocator);
77 var search_dirs = std.array_list.Managed(SearchDir).init(allocator);
7878 defer {
7979 for (search_dirs.items) |*search_dir| {
8080 search_dir.deinit(allocator);
......@@ -178,7 +178,7 @@ pub const Compiler = struct {
178178 cwd: std.fs.Dir,
179179 state: State = .{},
180180 diagnostics: *Diagnostics,
181 dependencies_list: ?*std.ArrayList([]const u8),
181 dependencies_list: ?*std.array_list.Managed([]const u8),
182182 input_code_pages: *const CodePageLookup,
183183 output_code_pages: *const CodePageLookup,
184184 search_dirs: []SearchDir,
......@@ -279,7 +279,7 @@ pub const Compiler = struct {
279279 .literal, .number => {
280280 const slice = literal_node.token.slice(self.source);
281281 const code_page = self.input_code_pages.getForToken(literal_node.token);
282 var buf = try std.ArrayList(u8).initCapacity(self.allocator, slice.len);
282 var buf = try std.array_list.Managed(u8).initCapacity(self.allocator, slice.len);
283283 errdefer buf.deinit();
284284
285285 var index: usize = 0;
......@@ -303,7 +303,7 @@ pub const Compiler = struct {
303303 const column = literal_node.token.calculateColumn(self.source, 8, null);
304304 const bytes = SourceBytes{ .slice = slice, .code_page = self.input_code_pages.getForToken(literal_node.token) };
305305
306 var buf = std.ArrayList(u8).init(self.allocator);
306 var buf = std.array_list.Managed(u8).init(self.allocator);
307307 errdefer buf.deinit();
308308
309309 // Filenames are sort-of parsed as if they were wide strings, but the max escape width of
......@@ -421,7 +421,7 @@ pub const Compiler = struct {
421421 const bytes = self.sourceBytesForToken(token);
422422 const output_code_page = self.output_code_pages.getForToken(token);
423423
424 var buf = try std.ArrayList(u8).initCapacity(self.allocator, bytes.slice.len);
424 var buf = try std.array_list.Managed(u8).initCapacity(self.allocator, bytes.slice.len);
425425 errdefer buf.deinit();
426426
427427 var iterative_parser = literals.IterativeStringParser.init(bytes, .{
......@@ -1226,7 +1226,7 @@ pub const Compiler = struct {
12261226 }
12271227
12281228 pub fn writeResourceRawData(self: *Compiler, node: *Node.ResourceRawData, writer: anytype) !void {
1229 var data_buffer = std.ArrayList(u8).init(self.allocator);
1229 var data_buffer = std.array_list.Managed(u8).init(self.allocator);
12301230 defer data_buffer.deinit();
12311231 // The header's data length field is a u32 so limit the resource's data size so that
12321232 // we know we can always specify the real size.
......@@ -1306,7 +1306,7 @@ pub const Compiler = struct {
13061306 }
13071307
13081308 pub fn writeAccelerators(self: *Compiler, node: *Node.Accelerators, writer: anytype) !void {
1309 var data_buffer = std.ArrayList(u8).init(self.allocator);
1309 var data_buffer = std.array_list.Managed(u8).init(self.allocator);
13101310 defer data_buffer.deinit();
13111311
13121312 // The header's data length field is a u32 so limit the resource's data size so that
......@@ -1405,7 +1405,7 @@ pub const Compiler = struct {
14051405 };
14061406
14071407 pub fn writeDialog(self: *Compiler, node: *Node.Dialog, writer: anytype) !void {
1408 var data_buffer = std.ArrayList(u8).init(self.allocator);
1408 var data_buffer = std.array_list.Managed(u8).init(self.allocator);
14091409 defer data_buffer.deinit();
14101410 // The header's data length field is a u32 so limit the resource's data size so that
14111411 // we know we can always specify the real size.
......@@ -1973,7 +1973,7 @@ pub const Compiler = struct {
19731973 try NameOrOrdinal.writeEmpty(data_writer);
19741974 }
19751975
1976 var extra_data_buf = std.ArrayList(u8).init(self.allocator);
1976 var extra_data_buf = std.array_list.Managed(u8).init(self.allocator);
19771977 defer extra_data_buf.deinit();
19781978 // The extra data byte length must be able to fit within a u16.
19791979 var limited_extra_data_writer = limitedWriter(extra_data_buf.writer(), std.math.maxInt(u16));
......@@ -2004,7 +2004,7 @@ pub const Compiler = struct {
20042004 }
20052005
20062006 pub fn writeToolbar(self: *Compiler, node: *Node.Toolbar, writer: anytype) !void {
2007 var data_buffer = std.ArrayList(u8).init(self.allocator);
2007 var data_buffer = std.array_list.Managed(u8).init(self.allocator);
20082008 defer data_buffer.deinit();
20092009 const data_writer = data_buffer.writer();
20102010
......@@ -2082,7 +2082,7 @@ pub const Compiler = struct {
20822082 }
20832083
20842084 pub fn writeMenu(self: *Compiler, node: *Node.Menu, writer: anytype) !void {
2085 var data_buffer = std.ArrayList(u8).init(self.allocator);
2085 var data_buffer = std.array_list.Managed(u8).init(self.allocator);
20862086 defer data_buffer.deinit();
20872087 // The header's data length field is a u32 so limit the resource's data size so that
20882088 // we know we can always specify the real size.
......@@ -2265,7 +2265,7 @@ pub const Compiler = struct {
22652265 }
22662266
22672267 pub fn writeVersionInfo(self: *Compiler, node: *Node.VersionInfo, writer: anytype) !void {
2268 var data_buffer = std.ArrayList(u8).init(self.allocator);
2268 var data_buffer = std.array_list.Managed(u8).init(self.allocator);
22692269 defer data_buffer.deinit();
22702270 // The node's length field (which is inclusive of the length of all of its children) is a u16
22712271 // so limit the node's data size so that we know we can always specify the real size.
......@@ -2394,7 +2394,7 @@ pub const Compiler = struct {
23942394 /// Expects writer to be a LimitedWriter limited to u16, meaning all writes to
23952395 /// the writer within this function could return error.NoSpaceLeft, and that buf.items.len
23962396 /// will never be able to exceed maxInt(u16).
2397 pub fn writeVersionNode(self: *Compiler, node: *Node, writer: *std.Io.Writer, buf: *std.ArrayList(u8)) !void {
2397 pub fn writeVersionNode(self: *Compiler, node: *Node, writer: *std.Io.Writer, buf: *std.array_list.Managed(u8)) !void {
23982398 // We can assume that buf.items.len will never be able to exceed the limits of a u16
23992399 try writeDataPadding(writer, @as(u16, @intCast(buf.items.len)));
24002400
......@@ -3246,7 +3246,7 @@ pub const StringTable = struct {
32463246 }
32473247
32483248 pub fn writeResData(self: *Block, compiler: *Compiler, language: res.Language, block_id: u16, writer: anytype) !void {
3249 var data_buffer = std.ArrayList(u8).init(compiler.allocator);
3249 var data_buffer = std.array_list.Managed(u8).init(compiler.allocator);
32503250 defer data_buffer.deinit();
32513251 const data_writer = data_buffer.writer();
32523252
lib/compiler/resinator/ico.zig+1-1
......@@ -56,7 +56,7 @@ pub fn readAnyError(allocator: std.mem.Allocator, reader: anytype, max_size: u64
5656 // entries than it actually does, we use an ArrayList with a conservatively
5757 // limited initial capacity instead of allocating the entire slice at once.
5858 const initial_capacity = @min(num_images, 8);
59 var entries = try std.ArrayList(Entry).initCapacity(allocator, initial_capacity);
59 var entries = try std.array_list.Managed(Entry).initCapacity(allocator, initial_capacity);
6060 errdefer entries.deinit();
6161
6262 var i: usize = 0;
lib/compiler/resinator/literals.zig+2-2
......@@ -469,7 +469,7 @@ pub fn parseQuotedString(
469469 const T = if (literal_type == .ascii) u8 else u16;
470470 std.debug.assert(bytes.slice.len >= 2); // must at least have 2 double quote chars
471471
472 var buf = try std.ArrayList(T).initCapacity(allocator, bytes.slice.len);
472 var buf = try std.array_list.Managed(T).initCapacity(allocator, bytes.slice.len);
473473 errdefer buf.deinit();
474474
475475 var iterative_parser = IterativeStringParser.init(bytes, options);
......@@ -564,7 +564,7 @@ pub fn parseQuotedStringAsWideString(allocator: std.mem.Allocator, bytes: Source
564564 // Note: We're only handling the case of parsing an ASCII string into a wide string from here on out.
565565 // TODO: The logic below is similar to that in AcceleratorKeyCodepointTranslator, might be worth merging the two
566566
567 var buf = try std.ArrayList(u16).initCapacity(allocator, bytes.slice.len);
567 var buf = try std.array_list.Managed(u16).initCapacity(allocator, bytes.slice.len);
568568 errdefer buf.deinit();
569569
570570 var iterative_parser = IterativeStringParser.init(bytes, options);
lib/compiler/resinator/main.zig+6-6
......@@ -97,14 +97,14 @@ pub fn main() !void {
9797 try stdout_writer.writeByte('\n');
9898 }
9999
100 var dependencies_list = std.ArrayList([]const u8).init(allocator);
100 var dependencies_list = std.array_list.Managed([]const u8).init(allocator);
101101 defer {
102102 for (dependencies_list.items) |item| {
103103 allocator.free(item);
104104 }
105105 dependencies_list.deinit();
106106 }
107 const maybe_dependencies_list: ?*std.ArrayList([]const u8) = if (options.depfile_path != null) &dependencies_list else null;
107 const maybe_dependencies_list: ?*std.array_list.Managed([]const u8) = if (options.depfile_path != null) &dependencies_list else null;
108108
109109 var include_paths = LazyIncludePaths{
110110 .arena = arena,
......@@ -115,7 +115,7 @@ pub fn main() !void {
115115
116116 const full_input = full_input: {
117117 if (options.input_format == .rc and options.preprocess != .no) {
118 var preprocessed_buf = std.ArrayList(u8).init(allocator);
118 var preprocessed_buf = std.array_list.Managed(u8).init(allocator);
119119 errdefer preprocessed_buf.deinit();
120120
121121 // We're going to throw away everything except the final preprocessed output anyway,
......@@ -127,7 +127,7 @@ pub fn main() !void {
127127 var comp = aro.Compilation.init(aro_arena, std.fs.cwd());
128128 defer comp.deinit();
129129
130 var argv = std.ArrayList([]const u8).init(comp.gpa);
130 var argv = std.array_list.Managed([]const u8).init(comp.gpa);
131131 defer argv.deinit();
132132
133133 try argv.append("arocc"); // dummy command name
......@@ -946,7 +946,7 @@ fn aroDiagnosticsToErrorBundle(
946946// - Only prints the message itself (no location, source line, error: prefix, etc)
947947// - Keeps track of source path/line/col instead
948948const MsgWriter = struct {
949 buf: std.ArrayList(u8),
949 buf: std.array_list.Managed(u8),
950950 path: ?[]const u8 = null,
951951 // 1-indexed
952952 line: u32 = undefined,
......@@ -956,7 +956,7 @@ const MsgWriter = struct {
956956
957957 fn init(allocator: std.mem.Allocator) MsgWriter {
958958 return .{
959 .buf = std.ArrayList(u8).init(allocator),
959 .buf = std.array_list.Managed(u8).init(allocator),
960960 };
961961 }
962962
lib/compiler/resinator/parse.zig+4-4
......@@ -82,7 +82,7 @@ pub const Parser = struct {
8282 }
8383
8484 fn parseRoot(self: *Self) Error!*Node {
85 var statements = std.ArrayList(*Node).init(self.state.allocator);
85 var statements = std.array_list.Managed(*Node).init(self.state.allocator);
8686 defer statements.deinit();
8787
8888 try self.parseStatements(&statements);
......@@ -95,7 +95,7 @@ pub const Parser = struct {
9595 return &node.base;
9696 }
9797
98 fn parseStatements(self: *Self, statements: *std.ArrayList(*Node)) Error!void {
98 fn parseStatements(self: *Self, statements: *std.array_list.Managed(*Node)) Error!void {
9999 while (true) {
100100 try self.nextToken(.whitespace_delimiter_only);
101101 if (self.state.token.id == .eof) break;
......@@ -355,7 +355,7 @@ pub const Parser = struct {
355355 const begin_token = self.state.token;
356356 try self.check(.begin);
357357
358 var strings = std.ArrayList(*Node).init(self.state.allocator);
358 var strings = std.array_list.Managed(*Node).init(self.state.allocator);
359359 defer strings.deinit();
360360 while (true) {
361361 const maybe_end_token = try self.lookaheadToken(.normal);
......@@ -852,7 +852,7 @@ pub const Parser = struct {
852852 /// Expects the current token to be a begin token.
853853 /// After return, the current token will be the end token.
854854 fn parseRawDataBlock(self: *Self) Error![]*Node {
855 var raw_data = std.ArrayList(*Node).init(self.state.allocator);
855 var raw_data = std.array_list.Managed(*Node).init(self.state.allocator);
856856 defer raw_data.deinit();
857857 while (true) {
858858 const maybe_end_token = try self.lookaheadToken(.normal);
lib/compiler/resinator/preprocess.zig+3-3
......@@ -11,14 +11,14 @@ pub fn preprocess(
1111 writer: anytype,
1212 /// Expects argv[0] to be the command name
1313 argv: []const []const u8,
14 maybe_dependencies_list: ?*std.ArrayList([]const u8),
14 maybe_dependencies_list: ?*std.array_list.Managed([]const u8),
1515) PreprocessError!void {
1616 try comp.addDefaultPragmaHandlers();
1717
1818 var driver: aro.Driver = .{ .comp = comp, .aro_name = "arocc" };
1919 defer driver.deinit();
2020
21 var macro_buf = std.ArrayList(u8).init(comp.gpa);
21 var macro_buf = std.array_list.Managed(u8).init(comp.gpa);
2222 defer macro_buf.deinit();
2323
2424 _ = driver.parseArgs(std.io.null_writer, macro_buf.writer(), argv) catch |err| switch (err) {
......@@ -87,7 +87,7 @@ fn hasAnyErrors(comp: *aro.Compilation) bool {
8787
8888/// `arena` is used for temporary -D argument strings and the INCLUDE environment variable.
8989/// The arena should be kept alive at least as long as `argv`.
90pub fn appendAroArgs(arena: Allocator, argv: *std.ArrayList([]const u8), options: cli.Options, system_include_paths: []const []const u8) !void {
90pub fn appendAroArgs(arena: Allocator, argv: *std.array_list.Managed([]const u8), options: cli.Options, system_include_paths: []const []const u8) !void {
9191 try argv.appendSlice(&.{
9292 "-E",
9393 "--comments",
lib/compiler/resinator/res.zig+1-1
......@@ -283,7 +283,7 @@ pub const NameOrOrdinal = union(enum) {
283283
284284 pub fn nameFromString(allocator: Allocator, bytes: SourceBytes) !NameOrOrdinal {
285285 // Names have a limit of 256 UTF-16 code units + null terminator
286 var buf = try std.ArrayList(u16).initCapacity(allocator, @min(257, bytes.slice.len));
286 var buf = try std.array_list.Managed(u16).initCapacity(allocator, @min(257, bytes.slice.len));
287287 errdefer buf.deinit();
288288
289289 var i: usize = 0;
lib/compiler/resinator/source_mapping.zig+1-1
......@@ -574,7 +574,7 @@ fn parseFilename(allocator: Allocator, str: []const u8) error{ OutOfMemory, Inva
574574 escape_u,
575575 };
576576
577 var filename = try std.ArrayList(u8).initCapacity(allocator, str.len);
577 var filename = try std.array_list.Managed(u8).initCapacity(allocator, str.len);
578578 errdefer filename.deinit();
579579 var state: State = .string;
580580 var index: usize = 0;
lib/compiler/resinator/windows1252.zig+1-1
......@@ -574,7 +574,7 @@ pub fn bestFitFromCodepoint(codepoint: u21) ?u8 {
574574}
575575
576576test "windows-1252 to utf8" {
577 var buf = std.ArrayList(u8).init(std.testing.allocator);
577 var buf = std.array_list.Managed(u8).init(std.testing.allocator);
578578 defer buf.deinit();
579579
580580 const input_windows1252 = "\x81pqrstuvwxyz{|}~\x80\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8e\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9e\x9f\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
lib/docs/wasm/markdown.zig+1-1
......@@ -1119,7 +1119,7 @@ fn testRender(input: []const u8, expected: []const u8) !void {
11191119 var doc = try parser.endInput();
11201120 defer doc.deinit(testing.allocator);
11211121
1122 var actual = std.ArrayList(u8).init(testing.allocator);
1122 var actual = std.array_list.Managed(u8).init(testing.allocator);
11231123 defer actual.deinit();
11241124 try doc.render(actual.writer());
11251125
lib/init/src/main.zig+4-3
......@@ -8,9 +8,10 @@ pub fn main() !void {
88}
99
1010test "simple test" {
11 var list = std.ArrayList(i32).init(std.testing.allocator);
12 defer list.deinit(); // Try commenting this out and see if zig detects the memory leak!
13 try list.append(42);
11 const gpa = std.testing.allocator;
12 var list: std.ArrayList(i32) = .empty;
13 defer list.deinit(gpa); // Try commenting this out and see if zig detects the memory leak!
14 try list.append(gpa, 42);
1415 try std.testing.expectEqual(@as(i32, 42), list.pop());
1516}
1617
lib/std/BitStack.zig+3-3
......@@ -4,14 +4,14 @@ const BitStack = @This();
44
55const std = @import("std");
66const Allocator = std.mem.Allocator;
7const ArrayList = std.ArrayList;
7const ArrayList = std.array_list.Managed;
88
9bytes: std.ArrayList(u8),
9bytes: std.array_list.Managed(u8),
1010bit_len: usize = 0,
1111
1212pub fn init(allocator: Allocator) @This() {
1313 return .{
14 .bytes = std.ArrayList(u8).init(allocator),
14 .bytes = std.array_list.Managed(u8).init(allocator),
1515 };
1616}
1717
lib/std/Build.zig+20-20
......@@ -7,7 +7,6 @@ const debug = std.debug;
77const panic = std.debug.panic;
88const assert = debug.assert;
99const log = std.log;
10const ArrayList = std.ArrayList;
1110const StringHashMap = std.StringHashMap;
1211const Allocator = mem.Allocator;
1312const Target = std.Target;
......@@ -16,6 +15,7 @@ const EnvMap = std.process.EnvMap;
1615const File = fs.File;
1716const Sha256 = std.crypto.hash.sha2.Sha256;
1817const Build = @This();
18const ArrayList = std.ArrayList;
1919
2020pub const Cache = @import("Build/Cache.zig");
2121pub const Step = @import("Build/Step.zig");
......@@ -32,7 +32,7 @@ uninstall_tls: TopLevelStep,
3232allocator: Allocator,
3333user_input_options: UserInputOptionsMap,
3434available_options_map: AvailableOptionsMap,
35available_options_list: ArrayList(AvailableOption),
35available_options_list: std.array_list.Managed(AvailableOption),
3636verbose: bool,
3737verbose_link: bool,
3838verbose_cc: bool,
......@@ -52,7 +52,7 @@ exe_dir: []const u8,
5252h_dir: []const u8,
5353install_path: []const u8,
5454sysroot: ?[]const u8 = null,
55search_prefixes: std.ArrayListUnmanaged([]const u8),
55search_prefixes: ArrayList([]const u8),
5656libc_file: ?[]const u8 = null,
5757/// Path to the directory containing build.zig.
5858build_root: Cache.Directory,
......@@ -220,10 +220,10 @@ const UserInputOption = struct {
220220const UserValue = union(enum) {
221221 flag: void,
222222 scalar: []const u8,
223 list: ArrayList([]const u8),
223 list: std.array_list.Managed([]const u8),
224224 map: StringHashMap(*const UserValue),
225225 lazy_path: LazyPath,
226 lazy_path_list: ArrayList(LazyPath),
226 lazy_path_list: std.array_list.Managed(LazyPath),
227227};
228228
229229const TypeId = enum {
......@@ -277,10 +277,10 @@ pub fn create(
277277 .allocator = arena,
278278 .user_input_options = UserInputOptionsMap.init(arena),
279279 .available_options_map = AvailableOptionsMap.init(arena),
280 .available_options_list = ArrayList(AvailableOption).init(arena),
280 .available_options_list = std.array_list.Managed(AvailableOption).init(arena),
281281 .top_level_steps = .{},
282282 .default_step = undefined,
283 .search_prefixes = .{},
283 .search_prefixes = .empty,
284284 .install_prefix = undefined,
285285 .lib_dir = undefined,
286286 .exe_dir = undefined,
......@@ -363,7 +363,7 @@ fn createChildOnly(
363363 },
364364 .user_input_options = user_input_options,
365365 .available_options_map = AvailableOptionsMap.init(allocator),
366 .available_options_list = ArrayList(AvailableOption).init(allocator),
366 .available_options_list = std.array_list.Managed(AvailableOption).init(allocator),
367367 .verbose = parent.verbose,
368368 .verbose_link = parent.verbose_link,
369369 .verbose_cc = parent.verbose_cc,
......@@ -468,7 +468,7 @@ fn addUserInputOptionFromArg(
468468 }) catch @panic("OOM");
469469 },
470470 []const LazyPath => return if (maybe_value) |v| {
471 var list = ArrayList(LazyPath).initCapacity(arena, v.len) catch @panic("OOM");
471 var list = std.array_list.Managed(LazyPath).initCapacity(arena, v.len) catch @panic("OOM");
472472 for (v) |lp| list.appendAssumeCapacity(lp.dupeInner(arena));
473473 map.put(field.name, .{
474474 .name = field.name,
......@@ -484,7 +484,7 @@ fn addUserInputOptionFromArg(
484484 }) catch @panic("OOM");
485485 },
486486 []const []const u8 => return if (maybe_value) |v| {
487 var list = ArrayList([]const u8).initCapacity(arena, v.len) catch @panic("OOM");
487 var list = std.array_list.Managed([]const u8).initCapacity(arena, v.len) catch @panic("OOM");
488488 for (v) |s| list.appendAssumeCapacity(arena.dupe(u8, s) catch @panic("OOM"));
489489 map.put(field.name, .{
490490 .name = field.name,
......@@ -542,7 +542,7 @@ fn addUserInputOptionFromArg(
542542 },
543543 .slice => switch (@typeInfo(ptr_info.child)) {
544544 .@"enum" => return if (maybe_value) |v| {
545 var list = ArrayList([]const u8).initCapacity(arena, v.len) catch @panic("OOM");
545 var list = std.array_list.Managed([]const u8).initCapacity(arena, v.len) catch @panic("OOM");
546546 for (v) |tag| list.appendAssumeCapacity(@tagName(tag));
547547 map.put(field.name, .{
548548 .name = field.name,
......@@ -589,10 +589,10 @@ fn addUserInputOptionFromArg(
589589const OrderedUserValue = union(enum) {
590590 flag: void,
591591 scalar: []const u8,
592 list: ArrayList([]const u8),
593 map: ArrayList(Pair),
592 list: std.array_list.Managed([]const u8),
593 map: std.array_list.Managed(Pair),
594594 lazy_path: LazyPath,
595 lazy_path_list: ArrayList(LazyPath),
595 lazy_path_list: std.array_list.Managed(LazyPath),
596596
597597 const Pair = struct {
598598 name: []const u8,
......@@ -642,8 +642,8 @@ const OrderedUserValue = union(enum) {
642642 }
643643 }
644644
645 fn mapFromUnordered(allocator: Allocator, unordered: std.StringHashMap(*const UserValue)) ArrayList(Pair) {
646 var ordered = ArrayList(Pair).init(allocator);
645 fn mapFromUnordered(allocator: Allocator, unordered: std.StringHashMap(*const UserValue)) std.array_list.Managed(Pair) {
646 var ordered = std.array_list.Managed(Pair).init(allocator);
647647 var it = unordered.iterator();
648648 while (it.next()) |entry| {
649649 ordered.append(.{
......@@ -694,7 +694,7 @@ const OrderedUserInputOption = struct {
694694// The hash should be consistent with the same values given a different order.
695695// This function takes a user input map, orders it, then hashes the contents.
696696fn hashUserInputOptionsMap(allocator: Allocator, user_input_options: UserInputOptionsMap, hasher: *std.hash.Wyhash) void {
697 var ordered = ArrayList(OrderedUserInputOption).init(allocator);
697 var ordered = std.array_list.Managed(OrderedUserInputOption).init(allocator);
698698 var it = user_input_options.iterator();
699699 while (it.next()) |entry|
700700 ordered.append(OrderedUserInputOption.fromUnordered(allocator, entry.value_ptr.*)) catch @panic("OOM");
......@@ -1086,7 +1086,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
10861086 const enum_options = if (type_id == .@"enum" or type_id == .enum_list) blk: {
10871087 const EnumType = if (type_id == .enum_list) @typeInfo(T).pointer.child else T;
10881088 const fields = comptime std.meta.fields(EnumType);
1089 var options = ArrayList([]const u8).initCapacity(b.allocator, fields.len) catch @panic("OOM");
1089 var options = std.array_list.Managed([]const u8).initCapacity(b.allocator, fields.len) catch @panic("OOM");
10901090
10911091 inline for (fields) |field| {
10921092 options.appendAssumeCapacity(field.name);
......@@ -1488,7 +1488,7 @@ pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8
14881488 switch (gop.value_ptr.value) {
14891489 .scalar => |s| {
14901490 // turn it into a list
1491 var list = ArrayList([]const u8).init(b.allocator);
1491 var list = std.array_list.Managed([]const u8).init(b.allocator);
14921492 try list.append(s);
14931493 try list.append(value);
14941494 try b.user_input_options.put(name, .{
......@@ -1596,7 +1596,7 @@ pub fn validateUserInputDidItFail(b: *Build) bool {
15961596}
15971597
15981598fn allocPrintCmd(gpa: Allocator, opt_cwd: ?[]const u8, argv: []const []const u8) error{OutOfMemory}![]u8 {
1599 var buf: std.ArrayListUnmanaged(u8) = .empty;
1599 var buf: ArrayList(u8) = .empty;
16001600 if (opt_cwd) |cwd| try buf.print(gpa, "cd {s} && ", .{cwd});
16011601 for (argv) |arg| {
16021602 try buf.print(gpa, "{s} ", .{arg});
lib/std/Build/Module.zig+9-8
......@@ -10,12 +10,12 @@ resolved_target: ?std.Build.ResolvedTarget = null,
1010optimize: ?std.builtin.OptimizeMode = null,
1111dwarf_format: ?std.dwarf.Format,
1212
13c_macros: std.ArrayListUnmanaged([]const u8),
14include_dirs: std.ArrayListUnmanaged(IncludeDir),
15lib_paths: std.ArrayListUnmanaged(LazyPath),
16rpaths: std.ArrayListUnmanaged(RPath),
13c_macros: ArrayList([]const u8),
14include_dirs: ArrayList(IncludeDir),
15lib_paths: ArrayList(LazyPath),
16rpaths: ArrayList(RPath),
1717frameworks: std.StringArrayHashMapUnmanaged(LinkFrameworkOptions),
18link_objects: std.ArrayListUnmanaged(LinkObject),
18link_objects: ArrayList(LinkObject),
1919
2020strip: ?bool,
2121unwind_tables: ?std.builtin.UnwindTables,
......@@ -170,7 +170,7 @@ pub const IncludeDir = union(enum) {
170170 pub fn appendZigProcessFlags(
171171 include_dir: IncludeDir,
172172 b: *std.Build,
173 zig_args: *std.ArrayList([]const u8),
173 zig_args: *std.array_list.Managed([]const u8),
174174 asking_step: ?*Step,
175175 ) !void {
176176 const flag: []const u8, const lazy_path: LazyPath = switch (include_dir) {
......@@ -537,7 +537,7 @@ pub fn addCMacro(m: *Module, name: []const u8, value: []const u8) void {
537537
538538pub fn appendZigProcessFlags(
539539 m: *Module,
540 zig_args: *std.ArrayList([]const u8),
540 zig_args: *std.array_list.Managed([]const u8),
541541 asking_step: ?*Step,
542542) !void {
543543 const b = m.owner;
......@@ -634,7 +634,7 @@ pub fn appendZigProcessFlags(
634634}
635635
636636fn addFlag(
637 args: *std.ArrayList([]const u8),
637 args: *std.array_list.Managed([]const u8),
638638 opt: ?bool,
639639 then_name: []const u8,
640640 else_name: []const u8,
......@@ -706,3 +706,4 @@ const std = @import("std");
706706const assert = std.debug.assert;
707707const LazyPath = std.Build.LazyPath;
708708const Step = std.Build.Step;
709const ArrayList = std.ArrayList;
lib/std/Build/Step.zig+17-16
......@@ -1,12 +1,22 @@
1const Step = @This();
2const std = @import("../std.zig");
3const Build = std.Build;
4const Allocator = std.mem.Allocator;
5const assert = std.debug.assert;
6const builtin = @import("builtin");
7const Cache = Build.Cache;
8const Path = Cache.Path;
9const ArrayList = std.ArrayList;
10
111id: Id,
212name: []const u8,
313owner: *Build,
414makeFn: MakeFn,
515
6dependencies: std.ArrayList(*Step),
16dependencies: std.array_list.Managed(*Step),
717/// This field is empty during execution of the user's build script, and
818/// then populated during dependency loop checking in the build runner.
9dependants: std.ArrayListUnmanaged(*Step),
19dependants: ArrayList(*Step),
1020/// Collects the set of files that retrigger this step to run.
1121///
1222/// This is used by the build system's implementation of `--watch` but it can
......@@ -39,7 +49,7 @@ state: State,
3949/// total system memory available.
4050max_rss: usize,
4151
42result_error_msgs: std.ArrayListUnmanaged([]const u8),
52result_error_msgs: ArrayList([]const u8),
4353result_error_bundle: std.zig.ErrorBundle,
4454result_stderr: []const u8,
4555result_cached: bool,
......@@ -175,7 +185,7 @@ pub const Inputs = struct {
175185
176186 pub const Table = std.ArrayHashMapUnmanaged(Build.Cache.Path, Files, Build.Cache.Path.TableAdapter, false);
177187 /// The special file name "." means any changes inside the directory.
178 pub const Files = std.ArrayListUnmanaged([]const u8);
188 pub const Files = ArrayList([]const u8);
179189
180190 pub fn populated(inputs: *Inputs) bool {
181191 return inputs.table.count() != 0;
......@@ -204,8 +214,8 @@ pub fn init(options: StepOptions) Step {
204214 .name = arena.dupe(u8, options.name) catch @panic("OOM"),
205215 .owner = options.owner,
206216 .makeFn = options.makeFn,
207 .dependencies = std.ArrayList(*Step).init(arena),
208 .dependants = .{},
217 .dependencies = std.array_list.Managed(*Step).init(arena),
218 .dependants = .empty,
209219 .inputs = Inputs.init,
210220 .state = .precheck_unstarted,
211221 .max_rss = options.max_rss,
......@@ -326,15 +336,6 @@ pub fn dump(step: *Step, w: *std.Io.Writer, tty_config: std.Io.tty.Config) void
326336 }
327337}
328338
329const Step = @This();
330const std = @import("../std.zig");
331const Build = std.Build;
332const Allocator = std.mem.Allocator;
333const assert = std.debug.assert;
334const builtin = @import("builtin");
335const Cache = Build.Cache;
336const Path = Cache.Path;
337
338339pub fn evalChildProcess(s: *Step, argv: []const []const u8) ![]u8 {
339340 const run_result = try captureChildProcess(s, std.Progress.Node.none, argv);
340341 try handleChildProcessTerm(s, run_result.term, null, argv);
......@@ -980,7 +981,7 @@ fn addDirectoryWatchInputFromBuilder(step: *Step, builder: *Build, sub_path: []c
980981fn addWatchInputFromPath(step: *Step, path: Build.Cache.Path, basename: []const u8) !void {
981982 const gpa = step.owner.allocator;
982983 const gop = try step.inputs.table.getOrPut(gpa, path);
983 if (!gop.found_existing) gop.value_ptr.* = .{};
984 if (!gop.found_existing) gop.value_ptr.* = .empty;
984985 try gop.value_ptr.append(gpa, basename);
985986}
986987
lib/std/Build/Step/CheckObject.zig+23-23
......@@ -18,7 +18,7 @@ pub const base_id: Step.Id = .check_object;
1818step: Step,
1919source: std.Build.LazyPath,
2020max_bytes: usize = 20 * 1024 * 1024,
21checks: std.ArrayList(Check),
21checks: std.array_list.Managed(Check),
2222obj_format: std.Target.ObjectFormat,
2323
2424pub fn create(
......@@ -36,7 +36,7 @@ pub fn create(
3636 .makeFn = make,
3737 }),
3838 .source = source.dupe(owner),
39 .checks = std.ArrayList(Check).init(gpa),
39 .checks = std.array_list.Managed(Check).init(gpa),
4040 .obj_format = obj_format,
4141 };
4242 check_object.source.addStepDependencies(&check_object.step);
......@@ -81,7 +81,7 @@ const Action = struct {
8181 const hay = mem.trim(u8, haystack, " ");
8282 const phrase = mem.trim(u8, act.phrase.resolve(b, step), " ");
8383
84 var candidate_vars: std.ArrayList(struct { name: []const u8, value: u64 }) = .init(b.allocator);
84 var candidate_vars: std.array_list.Managed(struct { name: []const u8, value: u64 }) = .init(b.allocator);
8585 var hay_it = mem.tokenizeScalar(u8, hay, ' ');
8686 var needle_it = mem.tokenizeScalar(u8, phrase, ' ');
8787
......@@ -157,8 +157,8 @@ const Action = struct {
157157 fn computeCmp(act: Action, b: *std.Build, step: *Step, global_vars: anytype) !bool {
158158 const gpa = step.owner.allocator;
159159 const phrase = act.phrase.resolve(b, step);
160 var op_stack = std.ArrayList(enum { add, sub, mod, mul }).init(gpa);
161 var values = std.ArrayList(u64).init(gpa);
160 var op_stack = std.array_list.Managed(enum { add, sub, mod, mul }).init(gpa);
161 var values = std.array_list.Managed(u64).init(gpa);
162162
163163 var it = mem.tokenizeScalar(u8, phrase, ' ');
164164 while (it.next()) |next| {
......@@ -242,15 +242,15 @@ const ComputeCompareExpected = struct {
242242const Check = struct {
243243 kind: Kind,
244244 payload: Payload,
245 data: std.ArrayList(u8),
246 actions: std.ArrayList(Action),
245 data: std.array_list.Managed(u8),
246 actions: std.array_list.Managed(Action),
247247
248248 fn create(allocator: Allocator, kind: Kind) Check {
249249 return .{
250250 .kind = kind,
251251 .payload = .{ .none = {} },
252 .data = std.ArrayList(u8).init(allocator),
253 .actions = std.ArrayList(Action).init(allocator),
252 .data = std.array_list.Managed(u8).init(allocator),
253 .actions = std.array_list.Managed(Action).init(allocator),
254254 };
255255 }
256256
......@@ -1214,7 +1214,7 @@ const MachODumper = struct {
12141214 }
12151215
12161216 fn dumpRebaseInfo(ctx: ObjectContext, data: []const u8, writer: anytype) !void {
1217 var rebases = std.ArrayList(u64).init(ctx.gpa);
1217 var rebases = std.array_list.Managed(u64).init(ctx.gpa);
12181218 defer rebases.deinit();
12191219 try ctx.parseRebaseInfo(data, &rebases);
12201220 mem.sort(u64, rebases.items, {}, std.sort.asc(u64));
......@@ -1223,7 +1223,7 @@ const MachODumper = struct {
12231223 }
12241224 }
12251225
1226 fn parseRebaseInfo(ctx: ObjectContext, data: []const u8, rebases: *std.ArrayList(u64)) !void {
1226 fn parseRebaseInfo(ctx: ObjectContext, data: []const u8, rebases: *std.array_list.Managed(u64)) !void {
12271227 var stream = std.io.fixedBufferStream(data);
12281228 var creader = std.io.countingReader(stream.reader());
12291229 const reader = creader.reader();
......@@ -1313,7 +1313,7 @@ const MachODumper = struct {
13131313 };
13141314
13151315 fn dumpBindInfo(ctx: ObjectContext, data: []const u8, writer: anytype) !void {
1316 var bindings = std.ArrayList(Binding).init(ctx.gpa);
1316 var bindings = std.array_list.Managed(Binding).init(ctx.gpa);
13171317 defer {
13181318 for (bindings.items) |*b| {
13191319 b.deinit(ctx.gpa);
......@@ -1335,7 +1335,7 @@ const MachODumper = struct {
13351335 }
13361336 }
13371337
1338 fn parseBindInfo(ctx: ObjectContext, data: []const u8, bindings: *std.ArrayList(Binding)) !void {
1338 fn parseBindInfo(ctx: ObjectContext, data: []const u8, bindings: *std.array_list.Managed(Binding)) !void {
13391339 var stream = std.io.fixedBufferStream(data);
13401340 var creader = std.io.countingReader(stream.reader());
13411341 const reader = creader.reader();
......@@ -1346,7 +1346,7 @@ const MachODumper = struct {
13461346 var offset: u64 = 0;
13471347 var addend: i64 = 0;
13481348
1349 var name_buf = std.ArrayList(u8).init(ctx.gpa);
1349 var name_buf = std.array_list.Managed(u8).init(ctx.gpa);
13501350 defer name_buf.deinit();
13511351
13521352 while (true) {
......@@ -1434,7 +1434,7 @@ const MachODumper = struct {
14341434 var arena = std.heap.ArenaAllocator.init(ctx.gpa);
14351435 defer arena.deinit();
14361436
1437 var exports = std.ArrayList(Export).init(arena.allocator());
1437 var exports = std.array_list.Managed(Export).init(arena.allocator());
14381438 var it = TrieIterator{ .data = data };
14391439 try parseTrieNode(arena.allocator(), &it, "", &exports);
14401440
......@@ -1546,7 +1546,7 @@ const MachODumper = struct {
15461546 arena: Allocator,
15471547 it: *TrieIterator,
15481548 prefix: []const u8,
1549 exports: *std.ArrayList(Export),
1549 exports: *std.array_list.Managed(Export),
15501550 ) !void {
15511551 const size = try it.readUleb128();
15521552 if (size > 0) {
......@@ -1621,7 +1621,7 @@ const MachODumper = struct {
16211621 var ctx = ObjectContext{ .gpa = gpa, .data = bytes, .header = hdr };
16221622 try ctx.parse();
16231623
1624 var output = std.ArrayList(u8).init(gpa);
1624 var output = std.array_list.Managed(u8).init(gpa);
16251625 const writer = output.writer();
16261626
16271627 switch (check.kind) {
......@@ -1787,7 +1787,7 @@ const ElfDumper = struct {
17871787 try ctx.objects.append(gpa, .{ .name = name, .off = stream.pos, .len = size });
17881788 }
17891789
1790 var output = std.ArrayList(u8).init(gpa);
1790 var output = std.array_list.Managed(u8).init(gpa);
17911791 const writer = output.writer();
17921792
17931793 switch (check.kind) {
......@@ -1848,7 +1848,7 @@ const ElfDumper = struct {
18481848 files.putAssumeCapacityNoClobber(object.off - @sizeOf(elf.ar_hdr), object.name);
18491849 }
18501850
1851 var symbols = std.AutoArrayHashMap(usize, std.ArrayList([]const u8)).init(ctx.gpa);
1851 var symbols = std.AutoArrayHashMap(usize, std.array_list.Managed([]const u8)).init(ctx.gpa);
18521852 defer {
18531853 for (symbols.values()) |*value| {
18541854 value.deinit();
......@@ -1859,7 +1859,7 @@ const ElfDumper = struct {
18591859 for (ctx.symtab.items) |entry| {
18601860 const gop = try symbols.getOrPut(@intCast(entry.off));
18611861 if (!gop.found_existing) {
1862 gop.value_ptr.* = std.ArrayList([]const u8).init(ctx.gpa);
1862 gop.value_ptr.* = std.array_list.Managed([]const u8).init(ctx.gpa);
18631863 }
18641864 try gop.value_ptr.append(entry.name);
18651865 }
......@@ -1944,7 +1944,7 @@ const ElfDumper = struct {
19441944 else => {},
19451945 };
19461946
1947 var output = std.ArrayList(u8).init(gpa);
1947 var output = std.array_list.Managed(u8).init(gpa);
19481948 const writer = output.writer();
19491949
19501950 switch (check.kind) {
......@@ -2398,7 +2398,7 @@ const WasmDumper = struct {
23982398 return error.UnsupportedWasmVersion;
23992399 }
24002400
2401 var output = std.ArrayList(u8).init(gpa);
2401 var output = std.array_list.Managed(u8).init(gpa);
24022402 defer output.deinit();
24032403 parseAndDumpInner(step, check, bytes, &fbs, &output) catch |err| switch (err) {
24042404 error.EndOfStream => try output.appendSlice("\n<UnexpectedEndOfStream>"),
......@@ -2412,7 +2412,7 @@ const WasmDumper = struct {
24122412 check: Check,
24132413 bytes: []const u8,
24142414 fbs: *std.io.FixedBufferStream([]const u8),
2415 output: *std.ArrayList(u8),
2415 output: *std.array_list.Managed(u8),
24162416 ) !void {
24172417 const reader = fbs.reader();
24182418 const writer = output.writer();
lib/std/Build/Step/Compile.zig+8-9
......@@ -4,7 +4,6 @@ const mem = std.mem;
44const fs = std.fs;
55const assert = std.debug.assert;
66const panic = std.debug.panic;
7const ArrayList = std.ArrayList;
87const StringHashMap = std.StringHashMap;
98const Sha256 = std.crypto.hash.sha2.Sha256;
109const Allocator = mem.Allocator;
......@@ -60,7 +59,7 @@ filters: []const []const u8,
6059test_runner: ?TestRunner,
6160wasi_exec_model: ?std.builtin.WasiExecModel = null,
6261
63installed_headers: ArrayList(HeaderInstallation),
62installed_headers: std.array_list.Managed(HeaderInstallation),
6463
6564/// This step is used to create an include tree that dependent modules can add to their include
6665/// search paths. Installed headers are copied to this step.
......@@ -421,7 +420,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
421420 .out_lib_filename = undefined,
422421 .major_only_filename = null,
423422 .name_only_filename = null,
424 .installed_headers = ArrayList(HeaderInstallation).init(owner.allocator),
423 .installed_headers = std.array_list.Managed(HeaderInstallation).init(owner.allocator),
425424 .zig_lib_dir = null,
426425 .exec_cmd_args = null,
427426 .filters = options.filters,
......@@ -766,9 +765,9 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
766765 else => return err,
767766 };
768767
769 var zig_cflags = ArrayList([]const u8).init(b.allocator);
768 var zig_cflags = std.array_list.Managed([]const u8).init(b.allocator);
770769 defer zig_cflags.deinit();
771 var zig_libs = ArrayList([]const u8).init(b.allocator);
770 var zig_libs = std.array_list.Managed([]const u8).init(b.allocator);
772771 defer zig_libs.deinit();
773772
774773 var arg_it = mem.tokenizeAny(u8, stdout, " \r\n\t");
......@@ -1076,7 +1075,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
10761075 const b = step.owner;
10771076 const arena = b.allocator;
10781077
1079 var zig_args = ArrayList([]const u8).init(arena);
1078 var zig_args = std.array_list.Managed([]const u8).init(arena);
10801079 defer zig_args.deinit();
10811080
10821081 try zig_args.append(b.graph.zig_exe);
......@@ -1798,7 +1797,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
17981797 try b.cache_root.handle.makePath("args");
17991798
18001799 const args_to_escape = zig_args.items[2..];
1801 var escaped_args = try ArrayList([]const u8).initCapacity(arena, args_to_escape.len);
1800 var escaped_args = try std.array_list.Managed([]const u8).initCapacity(arena, args_to_escape.len);
18021801 arg_blk: for (args_to_escape) |arg| {
18031802 for (arg, 0..) |c, arg_idx| {
18041803 if (c == '\\' or c == '"') {
......@@ -1948,7 +1947,7 @@ pub fn doAtomicSymLinks(
19481947fn execPkgConfigList(b: *std.Build, out_code: *u8) (PkgConfigError || RunError)![]const PkgConfigPkg {
19491948 const pkg_config_exe = b.graph.env_map.get("PKG_CONFIG") orelse "pkg-config";
19501949 const stdout = try b.runAllowFail(&[_][]const u8{ pkg_config_exe, "--list-all" }, out_code, .Ignore);
1951 var list = ArrayList(PkgConfigPkg).init(b.allocator);
1950 var list = std.array_list.Managed(PkgConfigPkg).init(b.allocator);
19521951 errdefer list.deinit();
19531952 var line_it = mem.tokenizeAny(u8, stdout, "\r\n");
19541953 while (line_it.next()) |line| {
......@@ -1985,7 +1984,7 @@ fn getPkgConfigList(b: *std.Build) ![]const PkgConfigPkg {
19851984 }
19861985}
19871986
1988fn addFlag(args: *ArrayList([]const u8), comptime name: []const u8, opt: ?bool) !void {
1987fn addFlag(args: *std.array_list.Managed([]const u8), comptime name: []const u8, opt: ?bool) !void {
19891988 const cond = opt orelse return;
19901989 try args.ensureUnusedCapacity(1);
19911990 if (cond) {
lib/std/Build/Step/ConfigHeader.zig+2-2
......@@ -621,7 +621,7 @@ fn expand_variables_cmake(
621621 contents: []const u8,
622622 values: std.StringArrayHashMap(Value),
623623) ![]const u8 {
624 var result: std.ArrayList(u8) = .init(allocator);
624 var result: std.array_list.Managed(u8) = .init(allocator);
625625 errdefer result.deinit();
626626
627627 const valid_varname_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/_.+-";
......@@ -633,7 +633,7 @@ fn expand_variables_cmake(
633633 source: usize,
634634 target: usize,
635635 };
636 var var_stack: std.ArrayList(Position) = .init(allocator);
636 var var_stack: std.array_list.Managed(Position) = .init(allocator);
637637 defer var_stack.deinit();
638638 loop: while (curr < contents.len) : (curr += 1) {
639639 switch (contents[curr]) {
lib/std/Build/Step/ObjCopy.zig+1-1
......@@ -182,7 +182,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
182182 return step.fail("unable to make path {s}: {s}", .{ cache_path, @errorName(err) });
183183 };
184184
185 var argv = std.ArrayList([]const u8).init(b.allocator);
185 var argv = std.array_list.Managed([]const u8).init(b.allocator);
186186 try argv.appendSlice(&.{ b.graph.zig_exe, "objcopy" });
187187
188188 if (objcopy.only_section) |only_section| {
lib/std/Build/Step/Run.zig+4-4
......@@ -679,15 +679,15 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
679679 const run: *Run = @fieldParentPtr("step", step);
680680 const has_side_effects = run.hasSideEffects();
681681
682 var argv_list = std.ArrayList([]const u8).init(arena);
683 var output_placeholders = std.ArrayList(IndexedOutput).init(arena);
682 var argv_list = std.array_list.Managed([]const u8).init(arena);
683 var output_placeholders = std.array_list.Managed(IndexedOutput).init(arena);
684684
685685 var man = b.graph.cache.obtain();
686686 defer man.deinit();
687687
688688 if (run.env_map) |env_map| {
689689 const KV = struct { []const u8, []const u8 };
690 var kv_pairs = try std.ArrayList(KV).initCapacity(arena, env_map.count());
690 var kv_pairs = try std.array_list.Managed(KV).initCapacity(arena, env_map.count());
691691 var iter = env_map.iterator();
692692 while (iter.next()) |entry| {
693693 kv_pairs.appendAssumeCapacity(.{ entry.key_ptr.*, entry.value_ptr.* });
......@@ -1080,7 +1080,7 @@ fn runCommand(
10801080 else => false,
10811081 };
10821082
1083 var interp_argv = std.ArrayList([]const u8).init(b.allocator);
1083 var interp_argv = std.array_list.Managed([]const u8).init(b.allocator);
10841084 defer interp_argv.deinit();
10851085
10861086 var env_map = run.env_map orelse &b.graph.env_map;
lib/std/Build/Step/TranslateC.zig+5-5
......@@ -10,8 +10,8 @@ pub const base_id: Step.Id = .translate_c;
1010
1111step: Step,
1212source: std.Build.LazyPath,
13include_dirs: std.ArrayList(std.Build.Module.IncludeDir),
14c_macros: std.ArrayList([]const u8),
13include_dirs: std.array_list.Managed(std.Build.Module.IncludeDir),
14c_macros: std.array_list.Managed([]const u8),
1515out_basename: []const u8,
1616target: std.Build.ResolvedTarget,
1717optimize: std.builtin.OptimizeMode,
......@@ -38,8 +38,8 @@ pub fn create(owner: *std.Build, options: Options) *TranslateC {
3838 .makeFn = make,
3939 }),
4040 .source = source,
41 .include_dirs = std.ArrayList(std.Build.Module.IncludeDir).init(owner.allocator),
42 .c_macros = std.ArrayList([]const u8).init(owner.allocator),
41 .include_dirs = std.array_list.Managed(std.Build.Module.IncludeDir).init(owner.allocator),
42 .c_macros = std.array_list.Managed([]const u8).init(owner.allocator),
4343 .out_basename = undefined,
4444 .target = options.target,
4545 .optimize = options.optimize,
......@@ -153,7 +153,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
153153 const b = step.owner;
154154 const translate_c: *TranslateC = @fieldParentPtr("step", step);
155155
156 var argv_list = std.ArrayList([]const u8).init(b.allocator);
156 var argv_list = std.array_list.Managed([]const u8).init(b.allocator);
157157 try argv_list.append(b.graph.zig_exe);
158158 try argv_list.append("translate-c");
159159 if (translate_c.link_libc) {
lib/std/Io.zig+3-3
......@@ -117,7 +117,7 @@ pub fn GenericReader(
117117
118118 pub inline fn readAllArrayList(
119119 self: Self,
120 array_list: *std.ArrayList(u8),
120 array_list: *std.array_list.Managed(u8),
121121 max_append_size: usize,
122122 ) (error{StreamTooLong} || Allocator.Error || Error)!void {
123123 return @errorCast(self.any().readAllArrayList(array_list, max_append_size));
......@@ -126,7 +126,7 @@ pub fn GenericReader(
126126 pub inline fn readAllArrayListAligned(
127127 self: Self,
128128 comptime alignment: ?Alignment,
129 array_list: *std.ArrayListAligned(u8, alignment),
129 array_list: *std.array_list.AlignedManaged(u8, alignment),
130130 max_append_size: usize,
131131 ) (error{StreamTooLong} || Allocator.Error || Error)!void {
132132 return @errorCast(self.any().readAllArrayListAligned(
......@@ -146,7 +146,7 @@ pub fn GenericReader(
146146
147147 pub inline fn readUntilDelimiterArrayList(
148148 self: Self,
149 array_list: *std.ArrayList(u8),
149 array_list: *std.array_list.Managed(u8),
150150 delimiter: u8,
151151 max_size: usize,
152152 ) (NoEofError || Allocator.Error || error{StreamTooLong})!void {
lib/std/Io/DeprecatedReader.zig+11-11
......@@ -39,14 +39,14 @@ pub fn readNoEof(self: Self, buf: []u8) anyerror!void {
3939 if (amt_read < buf.len) return error.EndOfStream;
4040}
4141
42/// Appends to the `std.ArrayList` contents by reading from the stream
42/// Appends to the `std.array_list.Managed` contents by reading from the stream
4343/// until end of stream is found.
4444/// If the number of bytes appended would exceed `max_append_size`,
4545/// `error.StreamTooLong` is returned
46/// and the `std.ArrayList` has exactly `max_append_size` bytes appended.
46/// and the `std.array_list.Managed` has exactly `max_append_size` bytes appended.
4747pub fn readAllArrayList(
4848 self: Self,
49 array_list: *std.ArrayList(u8),
49 array_list: *std.array_list.Managed(u8),
5050 max_append_size: usize,
5151) anyerror!void {
5252 return self.readAllArrayListAligned(null, array_list, max_append_size);
......@@ -55,7 +55,7 @@ pub fn readAllArrayList(
5555pub fn readAllArrayListAligned(
5656 self: Self,
5757 comptime alignment: ?Alignment,
58 array_list: *std.ArrayListAligned(u8, alignment),
58 array_list: *std.array_list.AlignedManaged(u8, alignment),
5959 max_append_size: usize,
6060) anyerror!void {
6161 try array_list.ensureTotalCapacity(@min(max_append_size, 4096));
......@@ -87,20 +87,20 @@ pub fn readAllArrayListAligned(
8787/// Caller owns returned memory.
8888/// If this function returns an error, the contents from the stream read so far are lost.
8989pub fn readAllAlloc(self: Self, allocator: mem.Allocator, max_size: usize) anyerror![]u8 {
90 var array_list = std.ArrayList(u8).init(allocator);
90 var array_list = std.array_list.Managed(u8).init(allocator);
9191 defer array_list.deinit();
9292 try self.readAllArrayList(&array_list, max_size);
9393 return try array_list.toOwnedSlice();
9494}
9595
9696/// Deprecated: use `streamUntilDelimiter` with ArrayList's writer instead.
97/// Replaces the `std.ArrayList` contents by reading from the stream until `delimiter` is found.
97/// Replaces the `std.array_list.Managed` contents by reading from the stream until `delimiter` is found.
9898/// Does not include the delimiter in the result.
99/// If the `std.ArrayList` length would exceed `max_size`, `error.StreamTooLong` is returned and the
100/// `std.ArrayList` is populated with `max_size` bytes from the stream.
99/// If the `std.array_list.Managed` length would exceed `max_size`, `error.StreamTooLong` is returned and the
100/// `std.array_list.Managed` is populated with `max_size` bytes from the stream.
101101pub fn readUntilDelimiterArrayList(
102102 self: Self,
103 array_list: *std.ArrayList(u8),
103 array_list: *std.array_list.Managed(u8),
104104 delimiter: u8,
105105 max_size: usize,
106106) anyerror!void {
......@@ -119,7 +119,7 @@ pub fn readUntilDelimiterAlloc(
119119 delimiter: u8,
120120 max_size: usize,
121121) anyerror![]u8 {
122 var array_list = std.ArrayList(u8).init(allocator);
122 var array_list = std.array_list.Managed(u8).init(allocator);
123123 defer array_list.deinit();
124124 try self.streamUntilDelimiter(array_list.writer(), delimiter, max_size);
125125 return try array_list.toOwnedSlice();
......@@ -154,7 +154,7 @@ pub fn readUntilDelimiterOrEofAlloc(
154154 delimiter: u8,
155155 max_size: usize,
156156) anyerror!?[]u8 {
157 var array_list = std.ArrayList(u8).init(allocator);
157 var array_list = std.array_list.Managed(u8).init(allocator);
158158 defer array_list.deinit();
159159 self.streamUntilDelimiter(array_list.writer(), delimiter, max_size) catch |err| switch (err) {
160160 error.EndOfStream => if (array_list.items.len == 0) {
lib/std/Io/Reader/test.zig+4-4
......@@ -34,7 +34,7 @@ test "skipBytes" {
3434
3535test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the delimiter, then EndOfStream" {
3636 const a = std.testing.allocator;
37 var list = std.ArrayList(u8).init(a);
37 var list = std.array_list.Managed(u8).init(a);
3838 defer list.deinit();
3939
4040 var fis = std.io.fixedBufferStream("0000\n1234\n");
......@@ -49,7 +49,7 @@ test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the d
4949
5050test "readUntilDelimiterArrayList returns an empty ArrayList" {
5151 const a = std.testing.allocator;
52 var list = std.ArrayList(u8).init(a);
52 var list = std.array_list.Managed(u8).init(a);
5353 defer list.deinit();
5454
5555 var fis = std.io.fixedBufferStream("\n");
......@@ -61,7 +61,7 @@ test "readUntilDelimiterArrayList returns an empty ArrayList" {
6161
6262test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with bytes read until the delimiter" {
6363 const a = std.testing.allocator;
64 var list = std.ArrayList(u8).init(a);
64 var list = std.array_list.Managed(u8).init(a);
6565 defer list.deinit();
6666
6767 var fis = std.io.fixedBufferStream("1234567\n");
......@@ -75,7 +75,7 @@ test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with
7575
7676test "readUntilDelimiterArrayList returns EndOfStream" {
7777 const a = std.testing.allocator;
78 var list = std.ArrayList(u8).init(a);
78 var list = std.array_list.Managed(u8).init(a);
7979 defer list.deinit();
8080
8181 var fis = std.io.fixedBufferStream("1234");
lib/std/Target/Query.zig+13-12
......@@ -3,6 +3,15 @@
33//! provide meaningful and unsurprising defaults. This struct does reference
44//! any resources and it is copyable.
55
6const Query = @This();
7const std = @import("../std.zig");
8const builtin = @import("builtin");
9const assert = std.debug.assert;
10const Target = std.Target;
11const mem = std.mem;
12const Allocator = std.mem.Allocator;
13const ArrayList = std.ArrayList;
14
615/// `null` means native.
716cpu_arch: ?Target.Cpu.Arch = null,
817
......@@ -394,7 +403,7 @@ pub fn canDetectLibC(self: Query) bool {
394403
395404/// Formats a version with the patch component omitted if it is zero,
396405/// unlike SemanticVersion.format which formats all its version components regardless.
397fn formatVersion(version: SemanticVersion, gpa: Allocator, list: *std.ArrayListUnmanaged(u8)) !void {
406fn formatVersion(version: SemanticVersion, gpa: Allocator, list: *ArrayList(u8)) !void {
398407 if (version.patch == 0) {
399408 try list.print(gpa, "{d}.{d}", .{ version.major, version.minor });
400409 } else {
......@@ -408,7 +417,7 @@ pub fn zigTriple(self: Query, gpa: Allocator) Allocator.Error![]u8 {
408417 const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native";
409418 const os_name = if (self.os_tag) |os_tag| @tagName(os_tag) else "native";
410419
411 var result: std.ArrayListUnmanaged(u8) = .empty;
420 var result: ArrayList(u8) = .empty;
412421 defer result.deinit(gpa);
413422
414423 try result.print(gpa, "{s}-{s}", .{ arch_name, os_name });
......@@ -469,7 +478,7 @@ pub fn zigTriple(self: Query, gpa: Allocator) Allocator.Error![]u8 {
469478/// Renders the query into a textual representation that can be parsed via the
470479/// `-mcpu` flag passed to the Zig compiler.
471480/// Appends the result to `buffer`.
472pub fn serializeCpu(q: Query, buffer: *std.ArrayList(u8)) Allocator.Error!void {
481pub fn serializeCpu(q: Query, buffer: *std.array_list.Managed(u8)) Allocator.Error!void {
473482 try buffer.ensureUnusedCapacity(8);
474483 switch (q.cpu_model) {
475484 .native => {
......@@ -512,7 +521,7 @@ pub fn serializeCpu(q: Query, buffer: *std.ArrayList(u8)) Allocator.Error!void {
512521}
513522
514523pub fn serializeCpuAlloc(q: Query, ally: Allocator) Allocator.Error![]u8 {
515 var buffer = std.ArrayList(u8).init(ally);
524 var buffer = std.array_list.Managed(u8).init(ally);
516525 try serializeCpu(q, &buffer);
517526 return buffer.toOwnedSlice();
518527}
......@@ -596,14 +605,6 @@ fn versionEqualOpt(a: ?SemanticVersion, b: ?SemanticVersion) bool {
596605 return SemanticVersion.order(a.?, b.?) == .eq;
597606}
598607
599const Query = @This();
600const std = @import("../std.zig");
601const builtin = @import("builtin");
602const assert = std.debug.assert;
603const Target = std.Target;
604const mem = std.mem;
605const Allocator = std.mem.Allocator;
606
607608test parse {
608609 if (builtin.target.isGnuLibC()) {
609610 var query = try Query.parse(.{});
lib/std/array_list.zig+103-120
......@@ -5,27 +5,18 @@ const testing = std.testing;
55const mem = std.mem;
66const math = std.math;
77const Allocator = mem.Allocator;
8const ArrayList = std.ArrayList;
89
9/// A contiguous, growable list of items in memory.
10/// This is a wrapper around an array of T values. Initialize with `init`.
11///
12/// This struct internally stores a `std.mem.Allocator` for memory management.
13/// To manually specify an allocator with each function call see `ArrayListUnmanaged`.
14pub fn ArrayList(comptime T: type) type {
15 return ArrayListAligned(T, null);
10/// Deprecated.
11pub fn Managed(comptime T: type) type {
12 return AlignedManaged(T, null);
1613}
1714
18/// A contiguous, growable list of arbitrarily aligned items in memory.
19/// This is a wrapper around an array of T values aligned to `alignment`-byte
20/// addresses. If the specified alignment is `null`, then `@alignOf(T)` is used.
21/// Initialize with `init`.
22///
23/// This struct internally stores a `std.mem.Allocator` for memory management.
24/// To manually specify an allocator with each function call see `ArrayListAlignedUnmanaged`.
25pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) type {
15/// Deprecated.
16pub fn AlignedManaged(comptime T: type, comptime alignment: ?mem.Alignment) type {
2617 if (alignment) |a| {
2718 if (a.toByteUnits() == @alignOf(T)) {
28 return ArrayListAligned(T, null);
19 return AlignedManaged(T, null);
2920 }
3021 }
3122 return struct {
......@@ -96,11 +87,11 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty
9687 };
9788 }
9889
99 /// Initializes an ArrayListUnmanaged with the `items` and `capacity` fields
90 /// Initializes an ArrayList with the `items` and `capacity` fields
10091 /// of this ArrayList. Empties this ArrayList.
101 pub fn moveToUnmanaged(self: *Self) ArrayListAlignedUnmanaged(T, alignment) {
92 pub fn moveToUnmanaged(self: *Self) Aligned(T, alignment) {
10293 const allocator = self.allocator;
103 const result: ArrayListAlignedUnmanaged(T, alignment) = .{ .items = self.items, .capacity = self.capacity };
94 const result: Aligned(T, alignment) = .{ .items = self.items, .capacity = self.capacity };
10495 self.* = init(allocator);
10596 return result;
10697 }
......@@ -181,7 +172,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty
181172 // a new buffer and doing our own copy. With a realloc() call,
182173 // the allocator implementation would pointlessly copy our
183174 // extra capacity.
184 const new_capacity = ArrayListAlignedUnmanaged(T, alignment).growCapacity(self.capacity, new_len);
175 const new_capacity = Aligned(T, alignment).growCapacity(self.capacity, new_len);
185176 const old_memory = self.allocatedSlice();
186177 if (self.allocator.remap(old_memory, new_capacity)) |new_memory| {
187178 self.items.ptr = new_memory.ptr;
......@@ -449,7 +440,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty
449440
450441 if (self.capacity >= new_capacity) return;
451442
452 const better_capacity = ArrayListAlignedUnmanaged(T, alignment).growCapacity(self.capacity, new_capacity);
443 const better_capacity = Aligned(T, alignment).growCapacity(self.capacity, new_capacity);
453444 return self.ensureTotalCapacityPrecise(better_capacity);
454445 }
455446
......@@ -597,14 +588,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty
597588 };
598589}
599590
600/// An ArrayList, but the allocator is passed as a parameter to the relevant functions
601/// rather than stored in the struct itself. The same allocator must be used throughout
602/// the entire lifetime of an ArrayListUnmanaged. Initialize directly or with
603/// `initCapacity`, and deinitialize with `deinit` or use `toOwnedSlice`.
604pub fn ArrayListUnmanaged(comptime T: type) type {
605 return ArrayListAlignedUnmanaged(T, null);
606}
607
608591/// A contiguous, growable list of arbitrarily aligned items in memory.
609592/// This is a wrapper around an array of T values aligned to `alignment`-byte
610593/// addresses. If the specified alignment is `null`, then `@alignOf(T)` is used.
......@@ -614,10 +597,10 @@ pub fn ArrayListUnmanaged(comptime T: type) type {
614597/// or use `toOwnedSlice`.
615598///
616599/// Default initialization of this struct is deprecated; use `.empty` instead.
617pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alignment) type {
600pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type {
618601 if (alignment) |a| {
619602 if (a.toByteUnits() == @alignOf(T)) {
620 return ArrayListAlignedUnmanaged(T, null);
603 return Aligned(T, null);
621604 }
622605 }
623606 return struct {
......@@ -675,11 +658,11 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alig
675658
676659 /// Convert this list into an analogous memory-managed one.
677660 /// The returned list has ownership of the underlying memory.
678 pub fn toManaged(self: *Self, gpa: Allocator) ArrayListAligned(T, alignment) {
661 pub fn toManaged(self: *Self, gpa: Allocator) AlignedManaged(T, alignment) {
679662 return .{ .items = self.items, .capacity = self.capacity, .allocator = gpa };
680663 }
681664
682 /// ArrayListUnmanaged takes ownership of the passed in slice.
665 /// ArrayList takes ownership of the passed in slice.
683666 /// Deinitialize with `deinit` or use `toOwnedSlice`.
684667 pub fn fromOwnedSlice(slice: Slice) Self {
685668 return Self{
......@@ -688,7 +671,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alig
688671 };
689672 }
690673
691 /// ArrayListUnmanaged takes ownership of the passed in slice.
674 /// ArrayList takes ownership of the passed in slice.
692675 /// Deinitialize with `deinit` or use `toOwnedSlice`.
693676 pub fn fromOwnedSliceSentinel(comptime sentinel: T, slice: [:sentinel]T) Self {
694677 return Self{
......@@ -1444,7 +1427,7 @@ fn addOrOom(a: usize, b: usize) error{OutOfMemory}!usize {
14441427
14451428test "init" {
14461429 {
1447 var list = ArrayList(i32).init(testing.allocator);
1430 var list = Managed(i32).init(testing.allocator);
14481431 defer list.deinit();
14491432
14501433 try testing.expect(list.items.len == 0);
......@@ -1452,7 +1435,7 @@ test "init" {
14521435 }
14531436
14541437 {
1455 const list: ArrayListUnmanaged(i32) = .empty;
1438 const list: ArrayList(i32) = .empty;
14561439
14571440 try testing.expect(list.items.len == 0);
14581441 try testing.expect(list.capacity == 0);
......@@ -1462,13 +1445,13 @@ test "init" {
14621445test "initCapacity" {
14631446 const a = testing.allocator;
14641447 {
1465 var list = try ArrayList(i8).initCapacity(a, 200);
1448 var list = try Managed(i8).initCapacity(a, 200);
14661449 defer list.deinit();
14671450 try testing.expect(list.items.len == 0);
14681451 try testing.expect(list.capacity >= 200);
14691452 }
14701453 {
1471 var list = try ArrayListUnmanaged(i8).initCapacity(a, 200);
1454 var list = try ArrayList(i8).initCapacity(a, 200);
14721455 defer list.deinit(a);
14731456 try testing.expect(list.items.len == 0);
14741457 try testing.expect(list.capacity >= 200);
......@@ -1478,7 +1461,7 @@ test "initCapacity" {
14781461test "clone" {
14791462 const a = testing.allocator;
14801463 {
1481 var array = ArrayList(i32).init(a);
1464 var array = Managed(i32).init(a);
14821465 try array.append(-1);
14831466 try array.append(3);
14841467 try array.append(5);
......@@ -1497,7 +1480,7 @@ test "clone" {
14971480 try testing.expectEqual(@as(i32, 5), cloned.items[2]);
14981481 }
14991482 {
1500 var array: ArrayListUnmanaged(i32) = .empty;
1483 var array: ArrayList(i32) = .empty;
15011484 try array.append(a, -1);
15021485 try array.append(a, 3);
15031486 try array.append(a, 5);
......@@ -1519,7 +1502,7 @@ test "clone" {
15191502test "basic" {
15201503 const a = testing.allocator;
15211504 {
1522 var list = ArrayList(i32).init(a);
1505 var list = Managed(i32).init(a);
15231506 defer list.deinit();
15241507
15251508 {
......@@ -1569,7 +1552,7 @@ test "basic" {
15691552 try testing.expect(list.pop() == 33);
15701553 }
15711554 {
1572 var list: ArrayListUnmanaged(i32) = .empty;
1555 var list: ArrayList(i32) = .empty;
15731556 defer list.deinit(a);
15741557
15751558 {
......@@ -1623,7 +1606,7 @@ test "basic" {
16231606test "appendNTimes" {
16241607 const a = testing.allocator;
16251608 {
1626 var list = ArrayList(i32).init(a);
1609 var list = Managed(i32).init(a);
16271610 defer list.deinit();
16281611
16291612 try list.appendNTimes(2, 10);
......@@ -1633,7 +1616,7 @@ test "appendNTimes" {
16331616 }
16341617 }
16351618 {
1636 var list: ArrayListUnmanaged(i32) = .empty;
1619 var list: ArrayList(i32) = .empty;
16371620 defer list.deinit(a);
16381621
16391622 try list.appendNTimes(a, 2, 10);
......@@ -1647,12 +1630,12 @@ test "appendNTimes" {
16471630test "appendNTimes with failing allocator" {
16481631 const a = testing.failing_allocator;
16491632 {
1650 var list = ArrayList(i32).init(a);
1633 var list = Managed(i32).init(a);
16511634 defer list.deinit();
16521635 try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10));
16531636 }
16541637 {
1655 var list: ArrayListUnmanaged(i32) = .empty;
1638 var list: ArrayList(i32) = .empty;
16561639 defer list.deinit(a);
16571640 try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10));
16581641 }
......@@ -1661,7 +1644,7 @@ test "appendNTimes with failing allocator" {
16611644test "orderedRemove" {
16621645 const a = testing.allocator;
16631646 {
1664 var list = ArrayList(i32).init(a);
1647 var list = Managed(i32).init(a);
16651648 defer list.deinit();
16661649
16671650 try list.append(1);
......@@ -1687,7 +1670,7 @@ test "orderedRemove" {
16871670 try testing.expectEqual(@as(usize, 4), list.items.len);
16881671 }
16891672 {
1690 var list: ArrayListUnmanaged(i32) = .empty;
1673 var list: ArrayList(i32) = .empty;
16911674 defer list.deinit(a);
16921675
16931676 try list.append(a, 1);
......@@ -1714,7 +1697,7 @@ test "orderedRemove" {
17141697 }
17151698 {
17161699 // remove last item
1717 var list = ArrayList(i32).init(a);
1700 var list = Managed(i32).init(a);
17181701 defer list.deinit();
17191702 try list.append(1);
17201703 try testing.expectEqual(@as(i32, 1), list.orderedRemove(0));
......@@ -1722,7 +1705,7 @@ test "orderedRemove" {
17221705 }
17231706 {
17241707 // remove last item
1725 var list: ArrayListUnmanaged(i32) = .empty;
1708 var list: ArrayList(i32) = .empty;
17261709 defer list.deinit(a);
17271710 try list.append(a, 1);
17281711 try testing.expectEqual(@as(i32, 1), list.orderedRemove(0));
......@@ -1733,7 +1716,7 @@ test "orderedRemove" {
17331716test "swapRemove" {
17341717 const a = testing.allocator;
17351718 {
1736 var list = ArrayList(i32).init(a);
1719 var list = Managed(i32).init(a);
17371720 defer list.deinit();
17381721
17391722 try list.append(1);
......@@ -1759,7 +1742,7 @@ test "swapRemove" {
17591742 try testing.expect(list.items.len == 4);
17601743 }
17611744 {
1762 var list: ArrayListUnmanaged(i32) = .empty;
1745 var list: ArrayList(i32) = .empty;
17631746 defer list.deinit(a);
17641747
17651748 try list.append(a, 1);
......@@ -1789,7 +1772,7 @@ test "swapRemove" {
17891772test "insert" {
17901773 const a = testing.allocator;
17911774 {
1792 var list = ArrayList(i32).init(a);
1775 var list = Managed(i32).init(a);
17931776 defer list.deinit();
17941777
17951778 try list.insert(0, 1);
......@@ -1802,7 +1785,7 @@ test "insert" {
18021785 try testing.expect(list.items[3] == 3);
18031786 }
18041787 {
1805 var list: ArrayListUnmanaged(i32) = .empty;
1788 var list: ArrayList(i32) = .empty;
18061789 defer list.deinit(a);
18071790
18081791 try list.insert(a, 0, 1);
......@@ -1819,7 +1802,7 @@ test "insert" {
18191802test "insertSlice" {
18201803 const a = testing.allocator;
18211804 {
1822 var list = ArrayList(i32).init(a);
1805 var list = Managed(i32).init(a);
18231806 defer list.deinit();
18241807
18251808 try list.append(1);
......@@ -1840,7 +1823,7 @@ test "insertSlice" {
18401823 try testing.expect(list.items[0] == 1);
18411824 }
18421825 {
1843 var list: ArrayListUnmanaged(i32) = .empty;
1826 var list: ArrayList(i32) = .empty;
18441827 defer list.deinit(a);
18451828
18461829 try list.append(a, 1);
......@@ -1862,11 +1845,11 @@ test "insertSlice" {
18621845 }
18631846}
18641847
1865test "ArrayList.replaceRange" {
1848test "Managed.replaceRange" {
18661849 const a = testing.allocator;
18671850
18681851 {
1869 var list = ArrayList(i32).init(a);
1852 var list = Managed(i32).init(a);
18701853 defer list.deinit();
18711854 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
18721855
......@@ -1875,7 +1858,7 @@ test "ArrayList.replaceRange" {
18751858 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
18761859 }
18771860 {
1878 var list = ArrayList(i32).init(a);
1861 var list = Managed(i32).init(a);
18791862 defer list.deinit();
18801863 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
18811864
......@@ -1888,7 +1871,7 @@ test "ArrayList.replaceRange" {
18881871 );
18891872 }
18901873 {
1891 var list = ArrayList(i32).init(a);
1874 var list = Managed(i32).init(a);
18921875 defer list.deinit();
18931876 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
18941877
......@@ -1897,7 +1880,7 @@ test "ArrayList.replaceRange" {
18971880 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
18981881 }
18991882 {
1900 var list = ArrayList(i32).init(a);
1883 var list = Managed(i32).init(a);
19011884 defer list.deinit();
19021885 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19031886
......@@ -1906,7 +1889,7 @@ test "ArrayList.replaceRange" {
19061889 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
19071890 }
19081891 {
1909 var list = ArrayList(i32).init(a);
1892 var list = Managed(i32).init(a);
19101893 defer list.deinit();
19111894 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19121895
......@@ -1916,11 +1899,11 @@ test "ArrayList.replaceRange" {
19161899 }
19171900}
19181901
1919test "ArrayList.replaceRangeAssumeCapacity" {
1902test "Managed.replaceRangeAssumeCapacity" {
19201903 const a = testing.allocator;
19211904
19221905 {
1923 var list = ArrayList(i32).init(a);
1906 var list = Managed(i32).init(a);
19241907 defer list.deinit();
19251908 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19261909
......@@ -1929,7 +1912,7 @@ test "ArrayList.replaceRangeAssumeCapacity" {
19291912 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
19301913 }
19311914 {
1932 var list = ArrayList(i32).init(a);
1915 var list = Managed(i32).init(a);
19331916 defer list.deinit();
19341917 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19351918
......@@ -1942,7 +1925,7 @@ test "ArrayList.replaceRangeAssumeCapacity" {
19421925 );
19431926 }
19441927 {
1945 var list = ArrayList(i32).init(a);
1928 var list = Managed(i32).init(a);
19461929 defer list.deinit();
19471930 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19481931
......@@ -1951,7 +1934,7 @@ test "ArrayList.replaceRangeAssumeCapacity" {
19511934 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
19521935 }
19531936 {
1954 var list = ArrayList(i32).init(a);
1937 var list = Managed(i32).init(a);
19551938 defer list.deinit();
19561939 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19571940
......@@ -1960,7 +1943,7 @@ test "ArrayList.replaceRangeAssumeCapacity" {
19601943 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
19611944 }
19621945 {
1963 var list = ArrayList(i32).init(a);
1946 var list = Managed(i32).init(a);
19641947 defer list.deinit();
19651948 try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 });
19661949
......@@ -1970,11 +1953,11 @@ test "ArrayList.replaceRangeAssumeCapacity" {
19701953 }
19711954}
19721955
1973test "ArrayListUnmanaged.replaceRange" {
1956test "ArrayList.replaceRange" {
19741957 const a = testing.allocator;
19751958
19761959 {
1977 var list: ArrayListUnmanaged(i32) = .empty;
1960 var list: ArrayList(i32) = .empty;
19781961 defer list.deinit(a);
19791962 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
19801963
......@@ -1983,7 +1966,7 @@ test "ArrayListUnmanaged.replaceRange" {
19831966 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
19841967 }
19851968 {
1986 var list: ArrayListUnmanaged(i32) = .empty;
1969 var list: ArrayList(i32) = .empty;
19871970 defer list.deinit(a);
19881971 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
19891972
......@@ -1996,7 +1979,7 @@ test "ArrayListUnmanaged.replaceRange" {
19961979 );
19971980 }
19981981 {
1999 var list: ArrayListUnmanaged(i32) = .empty;
1982 var list: ArrayList(i32) = .empty;
20001983 defer list.deinit(a);
20011984 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20021985
......@@ -2005,7 +1988,7 @@ test "ArrayListUnmanaged.replaceRange" {
20051988 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
20061989 }
20071990 {
2008 var list: ArrayListUnmanaged(i32) = .empty;
1991 var list: ArrayList(i32) = .empty;
20091992 defer list.deinit(a);
20101993 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20111994
......@@ -2014,7 +1997,7 @@ test "ArrayListUnmanaged.replaceRange" {
20141997 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
20151998 }
20161999 {
2017 var list: ArrayListUnmanaged(i32) = .empty;
2000 var list: ArrayList(i32) = .empty;
20182001 defer list.deinit(a);
20192002 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20202003
......@@ -2024,11 +2007,11 @@ test "ArrayListUnmanaged.replaceRange" {
20242007 }
20252008}
20262009
2027test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
2010test "ArrayList.replaceRangeAssumeCapacity" {
20282011 const a = testing.allocator;
20292012
20302013 {
2031 var list: ArrayListUnmanaged(i32) = .empty;
2014 var list: ArrayList(i32) = .empty;
20322015 defer list.deinit(a);
20332016 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20342017
......@@ -2037,7 +2020,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
20372020 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
20382021 }
20392022 {
2040 var list: ArrayListUnmanaged(i32) = .empty;
2023 var list: ArrayList(i32) = .empty;
20412024 defer list.deinit(a);
20422025 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20432026
......@@ -2050,7 +2033,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
20502033 );
20512034 }
20522035 {
2053 var list: ArrayListUnmanaged(i32) = .empty;
2036 var list: ArrayList(i32) = .empty;
20542037 defer list.deinit(a);
20552038 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20562039
......@@ -2059,7 +2042,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
20592042 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
20602043 }
20612044 {
2062 var list: ArrayListUnmanaged(i32) = .empty;
2045 var list: ArrayList(i32) = .empty;
20632046 defer list.deinit(a);
20642047 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20652048
......@@ -2068,7 +2051,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
20682051 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
20692052 }
20702053 {
2071 var list: ArrayListUnmanaged(i32) = .empty;
2054 var list: ArrayList(i32) = .empty;
20722055 defer list.deinit(a);
20732056 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
20742057
......@@ -2080,15 +2063,15 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
20802063
20812064const Item = struct {
20822065 integer: i32,
2083 sub_items: ArrayList(Item),
2066 sub_items: Managed(Item),
20842067};
20852068
20862069const ItemUnmanaged = struct {
20872070 integer: i32,
2088 sub_items: ArrayListUnmanaged(ItemUnmanaged),
2071 sub_items: ArrayList(ItemUnmanaged),
20892072};
20902073
2091test "ArrayList(T) of struct T" {
2074test "Managed(T) of struct T" {
20922075 const a = std.testing.allocator;
20932076 {
20942077 var root = Item{ .integer = 1, .sub_items = .init(a) };
......@@ -2104,11 +2087,11 @@ test "ArrayList(T) of struct T" {
21042087 }
21052088}
21062089
2107test "ArrayList(u8) implements writer" {
2090test "Managed(u8) implements writer" {
21082091 const a = testing.allocator;
21092092
21102093 {
2111 var buffer = ArrayList(u8).init(a);
2094 var buffer = Managed(u8).init(a);
21122095 defer buffer.deinit();
21132096
21142097 const x: i32 = 42;
......@@ -2118,7 +2101,7 @@ test "ArrayList(u8) implements writer" {
21182101 try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);
21192102 }
21202103 {
2121 var list = ArrayListAligned(u8, .@"2").init(a);
2104 var list = AlignedManaged(u8, .@"2").init(a);
21222105 defer list.deinit();
21232106
21242107 const writer = list.writer();
......@@ -2131,11 +2114,11 @@ test "ArrayList(u8) implements writer" {
21312114 }
21322115}
21332116
2134test "ArrayListUnmanaged(u8) implements writer" {
2117test "ArrayList(u8) implements writer" {
21352118 const a = testing.allocator;
21362119
21372120 {
2138 var buffer: ArrayListUnmanaged(u8) = .empty;
2121 var buffer: ArrayList(u8) = .empty;
21392122 defer buffer.deinit(a);
21402123
21412124 const x: i32 = 42;
......@@ -2145,7 +2128,7 @@ test "ArrayListUnmanaged(u8) implements writer" {
21452128 try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);
21462129 }
21472130 {
2148 var list: ArrayListAlignedUnmanaged(u8, .@"2") = .empty;
2131 var list: Aligned(u8, .@"2") = .empty;
21492132 defer list.deinit(a);
21502133
21512134 const writer = list.writer(a);
......@@ -2163,7 +2146,7 @@ test "shrink still sets length when resizing is disabled" {
21632146 const a = failing_allocator.allocator();
21642147
21652148 {
2166 var list = ArrayList(i32).init(a);
2149 var list = Managed(i32).init(a);
21672150 defer list.deinit();
21682151
21692152 try list.append(1);
......@@ -2174,7 +2157,7 @@ test "shrink still sets length when resizing is disabled" {
21742157 try testing.expect(list.items.len == 1);
21752158 }
21762159 {
2177 var list: ArrayListUnmanaged(i32) = .empty;
2160 var list: ArrayList(i32) = .empty;
21782161 defer list.deinit(a);
21792162
21802163 try list.append(a, 1);
......@@ -2190,7 +2173,7 @@ test "shrinkAndFree with a copy" {
21902173 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
21912174 const a = failing_allocator.allocator();
21922175
2193 var list = ArrayList(i32).init(a);
2176 var list = Managed(i32).init(a);
21942177 defer list.deinit();
21952178
21962179 try list.appendNTimes(3, 16);
......@@ -2201,7 +2184,7 @@ test "shrinkAndFree with a copy" {
22012184test "addManyAsArray" {
22022185 const a = std.testing.allocator;
22032186 {
2204 var list = ArrayList(u8).init(a);
2187 var list = Managed(u8).init(a);
22052188 defer list.deinit();
22062189
22072190 (try list.addManyAsArray(4)).* = "aoeu".*;
......@@ -2211,7 +2194,7 @@ test "addManyAsArray" {
22112194 try testing.expectEqualSlices(u8, list.items, "aoeuasdf");
22122195 }
22132196 {
2214 var list: ArrayListUnmanaged(u8) = .empty;
2197 var list: ArrayList(u8) = .empty;
22152198 defer list.deinit(a);
22162199
22172200 (try list.addManyAsArray(a, 4)).* = "aoeu".*;
......@@ -2227,7 +2210,7 @@ test "growing memory preserves contents" {
22272210 // will be triggered in the next operation.
22282211 const a = std.testing.allocator;
22292212 {
2230 var list = ArrayList(u8).init(a);
2213 var list = Managed(u8).init(a);
22312214 defer list.deinit();
22322215
22332216 (try list.addManyAsArray(4)).* = "abcd".*;
......@@ -2241,7 +2224,7 @@ test "growing memory preserves contents" {
22412224 try testing.expectEqualSlices(u8, list.items, "abcdijklefgh");
22422225 }
22432226 {
2244 var list: ArrayListUnmanaged(u8) = .empty;
2227 var list: ArrayList(u8) = .empty;
22452228 defer list.deinit(a);
22462229
22472230 (try list.addManyAsArray(a, 4)).* = "abcd".*;
......@@ -2259,22 +2242,22 @@ test "growing memory preserves contents" {
22592242test "fromOwnedSlice" {
22602243 const a = testing.allocator;
22612244 {
2262 var orig_list = ArrayList(u8).init(a);
2245 var orig_list = Managed(u8).init(a);
22632246 defer orig_list.deinit();
22642247 try orig_list.appendSlice("foobar");
22652248
22662249 const slice = try orig_list.toOwnedSlice();
2267 var list = ArrayList(u8).fromOwnedSlice(a, slice);
2250 var list = Managed(u8).fromOwnedSlice(a, slice);
22682251 defer list.deinit();
22692252 try testing.expectEqualStrings(list.items, "foobar");
22702253 }
22712254 {
2272 var list = ArrayList(u8).init(a);
2255 var list = Managed(u8).init(a);
22732256 defer list.deinit();
22742257 try list.appendSlice("foobar");
22752258
22762259 const slice = try list.toOwnedSlice();
2277 var unmanaged = ArrayListUnmanaged(u8).fromOwnedSlice(slice);
2260 var unmanaged = ArrayList(u8).fromOwnedSlice(slice);
22782261 defer unmanaged.deinit(a);
22792262 try testing.expectEqualStrings(unmanaged.items, "foobar");
22802263 }
......@@ -2283,22 +2266,22 @@ test "fromOwnedSlice" {
22832266test "fromOwnedSliceSentinel" {
22842267 const a = testing.allocator;
22852268 {
2286 var orig_list = ArrayList(u8).init(a);
2269 var orig_list = Managed(u8).init(a);
22872270 defer orig_list.deinit();
22882271 try orig_list.appendSlice("foobar");
22892272
22902273 const sentinel_slice = try orig_list.toOwnedSliceSentinel(0);
2291 var list = ArrayList(u8).fromOwnedSliceSentinel(a, 0, sentinel_slice);
2274 var list = Managed(u8).fromOwnedSliceSentinel(a, 0, sentinel_slice);
22922275 defer list.deinit();
22932276 try testing.expectEqualStrings(list.items, "foobar");
22942277 }
22952278 {
2296 var list = ArrayList(u8).init(a);
2279 var list = Managed(u8).init(a);
22972280 defer list.deinit();
22982281 try list.appendSlice("foobar");
22992282
23002283 const sentinel_slice = try list.toOwnedSliceSentinel(0);
2301 var unmanaged = ArrayListUnmanaged(u8).fromOwnedSliceSentinel(0, sentinel_slice);
2284 var unmanaged = ArrayList(u8).fromOwnedSliceSentinel(0, sentinel_slice);
23022285 defer unmanaged.deinit(a);
23032286 try testing.expectEqualStrings(unmanaged.items, "foobar");
23042287 }
......@@ -2307,7 +2290,7 @@ test "fromOwnedSliceSentinel" {
23072290test "toOwnedSliceSentinel" {
23082291 const a = testing.allocator;
23092292 {
2310 var list = ArrayList(u8).init(a);
2293 var list = Managed(u8).init(a);
23112294 defer list.deinit();
23122295
23132296 try list.appendSlice("foobar");
......@@ -2317,7 +2300,7 @@ test "toOwnedSliceSentinel" {
23172300 try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0));
23182301 }
23192302 {
2320 var list: ArrayListUnmanaged(u8) = .empty;
2303 var list: ArrayList(u8) = .empty;
23212304 defer list.deinit(a);
23222305
23232306 try list.appendSlice(a, "foobar");
......@@ -2331,7 +2314,7 @@ test "toOwnedSliceSentinel" {
23312314test "accepts unaligned slices" {
23322315 const a = testing.allocator;
23332316 {
2334 var list = std.ArrayListAligned(u8, .@"8").init(a);
2317 var list = AlignedManaged(u8, .@"8").init(a);
23352318 defer list.deinit();
23362319
23372320 try list.appendSlice(&.{ 0, 1, 2, 3 });
......@@ -2341,7 +2324,7 @@ test "accepts unaligned slices" {
23412324 try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 });
23422325 }
23432326 {
2344 var list: std.ArrayListAlignedUnmanaged(u8, .@"8") = .empty;
2327 var list: Aligned(u8, .@"8") = .empty;
23452328 defer list.deinit(a);
23462329
23472330 try list.appendSlice(a, &.{ 0, 1, 2, 3 });
......@@ -2352,11 +2335,11 @@ test "accepts unaligned slices" {
23522335 }
23532336}
23542337
2355test "ArrayList(u0)" {
2356 // An ArrayList on zero-sized types should not need to allocate
2338test "Managed(u0)" {
2339 // An Managed on zero-sized types should not need to allocate
23572340 const a = testing.failing_allocator;
23582341
2359 var list = ArrayList(u0).init(a);
2342 var list = Managed(u0).init(a);
23602343 defer list.deinit();
23612344
23622345 try list.append(0);
......@@ -2372,10 +2355,10 @@ test "ArrayList(u0)" {
23722355 try testing.expectEqual(count, 3);
23732356}
23742357
2375test "ArrayList(?u32).pop()" {
2358test "Managed(?u32).pop()" {
23762359 const a = testing.allocator;
23772360
2378 var list = ArrayList(?u32).init(a);
2361 var list = Managed(?u32).init(a);
23792362 defer list.deinit();
23802363
23812364 try list.append(null);
......@@ -2389,10 +2372,10 @@ test "ArrayList(?u32).pop()" {
23892372 try testing.expect(list.pop() == null);
23902373}
23912374
2392test "ArrayList(u32).getLast()" {
2375test "Managed(u32).getLast()" {
23932376 const a = testing.allocator;
23942377
2395 var list = ArrayList(u32).init(a);
2378 var list = Managed(u32).init(a);
23962379 defer list.deinit();
23972380
23982381 try list.append(2);
......@@ -2400,10 +2383,10 @@ test "ArrayList(u32).getLast()" {
24002383 try testing.expectEqual(const_list.getLast(), 2);
24012384}
24022385
2403test "ArrayList(u32).getLastOrNull()" {
2386test "Managed(u32).getLastOrNull()" {
24042387 const a = testing.allocator;
24052388
2406 var list = ArrayList(u32).init(a);
2389 var list = Managed(u32).init(a);
24072390 defer list.deinit();
24082391
24092392 try testing.expectEqual(list.getLastOrNull(), null);
......@@ -2419,7 +2402,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value"
24192402 const items = &.{ 42, 43 };
24202403
24212404 {
2422 var list: ArrayListUnmanaged(u32) = .{
2405 var list: ArrayList(u32) = .{
24232406 .items = undefined,
24242407 .capacity = math.maxInt(usize) - 1,
24252408 };
......@@ -2436,7 +2419,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value"
24362419 }
24372420
24382421 {
2439 var list: ArrayList(u32) = .{
2422 var list: Managed(u32) = .{
24402423 .items = undefined,
24412424 .capacity = math.maxInt(usize) - 1,
24422425 .allocator = a,
......@@ -2457,7 +2440,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value"
24572440test "orderedRemoveMany" {
24582441 const gpa = testing.allocator;
24592442
2460 var list: ArrayListUnmanaged(usize) = .empty;
2443 var list: Aligned(usize, null) = .empty;
24612444 defer list.deinit(gpa);
24622445
24632446 for (0..10) |n| {
lib/std/compress/lzma2.zig+1-1
......@@ -18,7 +18,7 @@ test {
1818 const compressed = &[_]u8{ 0x01, 0x00, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x02, 0x00, 0x06, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x0A, 0x00 };
1919
2020 const allocator = std.testing.allocator;
21 var decomp = std.ArrayList(u8).init(allocator);
21 var decomp = std.array_list.Managed(u8).init(allocator);
2222 defer decomp.deinit();
2323 var stream = std.io.fixedBufferStream(compressed);
2424 try decompress(allocator, stream.reader(), decomp.writer());
lib/std/crypto/argon2.zig+3-3
......@@ -14,7 +14,7 @@ const pwhash = crypto.pwhash;
1414
1515const Thread = std.Thread;
1616const Blake2b512 = blake2.Blake2b512;
17const Blocks = std.ArrayListAligned([block_length]u64, .@"16");
17const Blocks = std.array_list.AlignedManaged([block_length]u64, .@"16");
1818const H0 = [Blake2b512.digest_length + 8]u8;
1919
2020const EncodingError = crypto.errors.EncodingError;
......@@ -252,7 +252,7 @@ fn processBlocksMt(
252252 lanes: u32,
253253 segments: u32,
254254) KdfError!void {
255 var threads_list = try std.ArrayList(Thread).initCapacity(allocator, threads);
255 var threads_list = try std.array_list.Managed(Thread).initCapacity(allocator, threads);
256256 defer threads_list.deinit();
257257
258258 var n: u32 = 0;
......@@ -507,7 +507,7 @@ pub fn kdf(
507507 var blocks = try Blocks.initCapacity(allocator, memory);
508508 defer blocks.deinit();
509509
510 blocks.appendNTimesAssumeCapacity([_]u64{0} ** block_length, memory);
510 blocks.appendNTimesAssumeCapacity(@splat(0), memory);
511511
512512 initBlocks(&blocks, &h0, memory, params.p);
513513 try processBlocks(allocator, &blocks, params.t, memory, params.p, mode);
lib/std/debug/Dwarf.zig+12-11
......@@ -27,6 +27,7 @@ const maxInt = std.math.maxInt;
2727const MemoryAccessor = std.debug.MemoryAccessor;
2828const Path = std.Build.Cache.Path;
2929const FixedBufferReader = std.debug.FixedBufferReader;
30const ArrayList = std.ArrayList;
3031
3132const Dwarf = @This();
3233
......@@ -42,11 +43,11 @@ sections: SectionArray = null_section_array,
4243is_macho: bool,
4344
4445/// Filled later by the initializer
45abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .empty,
46abbrev_table_list: ArrayList(Abbrev.Table) = .empty,
4647/// Filled later by the initializer
47compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .empty,
48compile_unit_list: ArrayList(CompileUnit) = .empty,
4849/// Filled later by the initializer
49func_list: std.ArrayListUnmanaged(Func) = .empty,
50func_list: ArrayList(Func) = .empty,
5051
5152/// Starts out non-`null` if the `.eh_frame_hdr` section is present. May become `null` later if we
5253/// find that `.eh_frame_hdr` is incomplete.
......@@ -54,10 +55,10 @@ eh_frame_hdr: ?ExceptionFrameHeader = null,
5455/// These lookup tables are only used if `eh_frame_hdr` is null
5556cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty,
5657/// Sorted by start_pc
57fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .empty,
58fde_list: ArrayList(FrameDescriptionEntry) = .empty,
5859
5960/// Populated by `populateRanges`.
60ranges: std.ArrayListUnmanaged(Range) = .empty,
61ranges: ArrayList(Range) = .empty,
6162
6263pub const Range = struct {
6364 start: u64,
......@@ -1038,7 +1039,7 @@ fn scanAllCompileUnits(di: *Dwarf, allocator: Allocator) ScanError!void {
10381039 var fbr: FixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian };
10391040 var this_unit_offset: u64 = 0;
10401041
1041 var attrs_buf = std.ArrayList(Die.Attr).init(allocator);
1042 var attrs_buf = std.array_list.Managed(Die.Attr).init(allocator);
10421043 defer attrs_buf.deinit();
10431044
10441045 while (this_unit_offset < fbr.buf.len) {
......@@ -1343,7 +1344,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table
13431344 .endian = di.endian,
13441345 };
13451346
1346 var abbrevs = std.ArrayList(Abbrev).init(allocator);
1347 var abbrevs = std.array_list.Managed(Abbrev).init(allocator);
13471348 defer {
13481349 for (abbrevs.items) |*abbrev| {
13491350 abbrev.deinit(allocator);
......@@ -1351,7 +1352,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table
13511352 abbrevs.deinit();
13521353 }
13531354
1354 var attrs = std.ArrayList(Abbrev.Attr).init(allocator);
1355 var attrs = std.array_list.Managed(Abbrev.Attr).init(allocator);
13551356 defer attrs.deinit();
13561357
13571358 while (true) {
......@@ -1468,9 +1469,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) !
14681469
14691470 const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1);
14701471
1471 var directories: std.ArrayListUnmanaged(FileEntry) = .empty;
1472 var directories: ArrayList(FileEntry) = .empty;
14721473 defer directories.deinit(gpa);
1473 var file_entries: std.ArrayListUnmanaged(FileEntry) = .empty;
1474 var file_entries: ArrayList(FileEntry) = .empty;
14741475 defer file_entries.deinit(gpa);
14751476
14761477 if (version < 5) {
......@@ -2244,7 +2245,7 @@ pub const ElfModule = struct {
22442245 if (chdr.ch_type != .ZLIB) continue;
22452246
22462247 var decompress: std.compress.flate.Decompress = .init(&section_reader, .zlib, &.{});
2247 var decompressed_section: std.ArrayListUnmanaged(u8) = .empty;
2248 var decompressed_section: ArrayList(u8) = .empty;
22482249 defer decompressed_section.deinit(gpa);
22492250 decompress.reader.appendRemainingUnlimited(gpa, null, &decompressed_section, std.compress.flate.history_len) catch {
22502251 invalidDebugInfoDetected();
lib/std/debug/Dwarf/expression.zig+4-4
......@@ -1064,7 +1064,7 @@ test "DWARF expressions" {
10641064
10651065 const b = Builder(options);
10661066
1067 var program = std.ArrayList(u8).init(allocator);
1067 var program = std.array_list.Managed(u8).init(allocator);
10681068 defer program.deinit();
10691069
10701070 const writer = program.writer();
......@@ -1120,7 +1120,7 @@ test "DWARF expressions" {
11201120 var mock_compile_unit: std.debug.Dwarf.CompileUnit = undefined;
11211121 mock_compile_unit.addr_base = 1;
11221122
1123 var mock_debug_addr = std.ArrayList(u8).init(allocator);
1123 var mock_debug_addr = std.array_list.Managed(u8).init(allocator);
11241124 defer mock_debug_addr.deinit();
11251125
11261126 try mock_debug_addr.writer().writeInt(u16, 0, native_endian);
......@@ -1590,7 +1590,7 @@ test "DWARF expressions" {
15901590
15911591 // Sub-expression
15921592 {
1593 var sub_program = std.ArrayList(u8).init(allocator);
1593 var sub_program = std.array_list.Managed(u8).init(allocator);
15941594 defer sub_program.deinit();
15951595 const sub_writer = sub_program.writer();
15961596 try b.writeLiteral(sub_writer, 3);
......@@ -1617,7 +1617,7 @@ test "DWARF expressions" {
16171617 if (abi.regBytes(&thread_context, 0, reg_context)) |reg_bytes| {
16181618 mem.writeInt(usize, reg_bytes[0..@sizeOf(usize)], 0xee, native_endian);
16191619
1620 var sub_program = std.ArrayList(u8).init(allocator);
1620 var sub_program = std.array_list.Managed(u8).init(allocator);
16211621 defer sub_program.deinit();
16221622 const sub_writer = sub_program.writer();
16231623 try b.writeReg(sub_writer, 0);
lib/std/debug/Pdb.zig+3-3
......@@ -76,7 +76,7 @@ pub fn parseDbiStream(self: *Pdb) !void {
7676 const mod_info_size = header.mod_info_size;
7777 const section_contrib_size = header.section_contribution_size;
7878
79 var modules = std.ArrayList(Module).init(self.allocator);
79 var modules = std.array_list.Managed(Module).init(self.allocator);
8080 errdefer modules.deinit();
8181
8282 // Module Info Substream
......@@ -117,7 +117,7 @@ pub fn parseDbiStream(self: *Pdb) !void {
117117 }
118118
119119 // Section Contribution Substream
120 var sect_contribs = std.ArrayList(pdb.SectionContribEntry).init(self.allocator);
120 var sect_contribs = std.array_list.Managed(pdb.SectionContribEntry).init(self.allocator);
121121 errdefer sect_contribs.deinit();
122122
123123 var sect_cont_offset: usize = 0;
......@@ -569,7 +569,7 @@ const MsfStream = struct {
569569
570570fn readSparseBitVector(stream: anytype, allocator: Allocator) ![]u32 {
571571 const num_words = try stream.readInt(u32, .little);
572 var list = std.ArrayList(u32).init(allocator);
572 var list = std.array_list.Managed(u32).init(allocator);
573573 errdefer list.deinit();
574574 var word_i: u32 = 0;
575575 while (word_i != num_words) : (word_i += 1) {
lib/std/fs/File.zig+1-1
......@@ -826,7 +826,7 @@ pub fn readToEndAllocOptions(
826826 // size. If the reported size is zero, as it happens on Linux for files
827827 // in /proc, a small buffer is allocated instead.
828828 const initial_cap = @min((if (size > 0) size else 1024), max_bytes) + @intFromBool(optional_sentinel != null);
829 var array_list = try std.ArrayListAligned(u8, alignment).initCapacity(allocator, initial_cap);
829 var array_list = try std.array_list.AlignedManaged(u8, alignment).initCapacity(allocator, initial_cap);
830830 defer array_list.deinit();
831831
832832 self.deprecatedReader().readAllArrayListAligned(alignment, &array_list, max_bytes) catch |err| switch (err) {
lib/std/fs/path.zig+2-2
......@@ -577,7 +577,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 {
577577 }
578578
579579 // Allocate result and fill in the disk designator.
580 var result = std.ArrayList(u8).init(allocator);
580 var result = std.array_list.Managed(u8).init(allocator);
581581 defer result.deinit();
582582
583583 const disk_designator_len: usize = l: {
......@@ -698,7 +698,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 {
698698pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.Error![]u8 {
699699 assert(paths.len > 0);
700700
701 var result = std.ArrayList(u8).init(allocator);
701 var result = std.array_list.Managed(u8).init(allocator);
702702 defer result.deinit();
703703
704704 var negative_count: usize = 0;
lib/std/fs/test.zig+5-5
......@@ -464,7 +464,7 @@ test "Dir.Iterator" {
464464 defer arena.deinit();
465465 const allocator = arena.allocator();
466466
467 var entries = std.ArrayList(Dir.Entry).init(allocator);
467 var entries = std.array_list.Managed(Dir.Entry).init(allocator);
468468
469469 // Create iterator.
470470 var iter = tmp_dir.dir.iterate();
......@@ -497,7 +497,7 @@ test "Dir.Iterator many entries" {
497497 defer arena.deinit();
498498 const allocator = arena.allocator();
499499
500 var entries = std.ArrayList(Dir.Entry).init(allocator);
500 var entries = std.array_list.Managed(Dir.Entry).init(allocator);
501501
502502 // Create iterator.
503503 var iter = tmp_dir.dir.iterate();
......@@ -531,7 +531,7 @@ test "Dir.Iterator twice" {
531531
532532 var i: u8 = 0;
533533 while (i < 2) : (i += 1) {
534 var entries = std.ArrayList(Dir.Entry).init(allocator);
534 var entries = std.array_list.Managed(Dir.Entry).init(allocator);
535535
536536 // Create iterator.
537537 var iter = tmp_dir.dir.iterate();
......@@ -567,7 +567,7 @@ test "Dir.Iterator reset" {
567567
568568 var i: u8 = 0;
569569 while (i < 2) : (i += 1) {
570 var entries = std.ArrayList(Dir.Entry).init(allocator);
570 var entries = std.array_list.Managed(Dir.Entry).init(allocator);
571571
572572 while (try iter.next()) |entry| {
573573 // We cannot just store `entry` as on Windows, we're re-using the name buffer
......@@ -617,7 +617,7 @@ fn entryEql(lhs: Dir.Entry, rhs: Dir.Entry) bool {
617617 return mem.eql(u8, lhs.name, rhs.name) and lhs.kind == rhs.kind;
618618}
619619
620fn contains(entries: *const std.ArrayList(Dir.Entry), el: Dir.Entry) bool {
620fn contains(entries: *const std.array_list.Managed(Dir.Entry), el: Dir.Entry) bool {
621621 for (entries.items) |entry| {
622622 if (entryEql(entry, el)) return true;
623623 }
lib/std/hash_map.zig+2-2
......@@ -1800,7 +1800,7 @@ test "put and remove loop in random order" {
18001800 var map = AutoHashMap(u32, u32).init(std.testing.allocator);
18011801 defer map.deinit();
18021802
1803 var keys = std.ArrayList(u32).init(std.testing.allocator);
1803 var keys = std.array_list.Managed(u32).init(std.testing.allocator);
18041804 defer keys.deinit();
18051805
18061806 const size = 32;
......@@ -1834,7 +1834,7 @@ test "remove one million elements in random order" {
18341834 var map = Map.init(std.heap.page_allocator);
18351835 defer map.deinit();
18361836
1837 var keys = std.ArrayList(u32).init(std.heap.page_allocator);
1837 var keys = std.array_list.Managed(u32).init(std.heap.page_allocator);
18381838 defer keys.deinit();
18391839
18401840 var i: u32 = 0;
lib/std/heap.zig+1-1
......@@ -673,7 +673,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void {
673673 var slice = try allocator.alignedAlloc(u8, .@"16", alloc_size);
674674 defer allocator.free(slice);
675675
676 var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator);
676 var stuff_to_free = std.array_list.Managed([]align(16) u8).init(debug_allocator);
677677 // On Windows, VirtualAlloc returns addresses aligned to a 64K boundary,
678678 // which is 16 pages, hence the 32. This test may require to increase
679679 // the size of the allocations feeding the `allocator` parameter if they
lib/std/heap/debug_allocator.zig+4-4
......@@ -1061,7 +1061,7 @@ test "small allocations - free in same order" {
10611061 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
10621062 const allocator = gpa.allocator();
10631063
1064 var list = std.ArrayList(*u64).init(std.testing.allocator);
1064 var list = std.array_list.Managed(*u64).init(std.testing.allocator);
10651065 defer list.deinit();
10661066
10671067 var i: usize = 0;
......@@ -1080,7 +1080,7 @@ test "small allocations - free in reverse order" {
10801080 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
10811081 const allocator = gpa.allocator();
10821082
1083 var list = std.ArrayList(*u64).init(std.testing.allocator);
1083 var list = std.array_list.Managed(*u64).init(std.testing.allocator);
10841084 defer list.deinit();
10851085
10861086 var i: usize = 0;
......@@ -1241,7 +1241,7 @@ test "shrink large object to large object with larger alignment" {
12411241 // This loop allocates until we find a page that is not aligned to the big
12421242 // alignment. Then we shrink the allocation after the loop, but increase the
12431243 // alignment to the higher one, that we know will force it to realloc.
1244 var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator);
1244 var stuff_to_free = std.array_list.Managed([]align(16) u8).init(debug_allocator);
12451245 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {
12461246 try stuff_to_free.append(slice);
12471247 slice = try allocator.alignedAlloc(u8, .@"16", alloc_size);
......@@ -1313,7 +1313,7 @@ test "realloc large object to larger alignment" {
13131313
13141314 const big_alignment: usize = default_page_size * 2;
13151315 // This loop allocates until we find a page that is not aligned to the big alignment.
1316 var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator);
1316 var stuff_to_free = std.array_list.Managed([]align(16) u8).init(debug_allocator);
13171317 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {
13181318 try stuff_to_free.append(slice);
13191319 slice = try allocator.alignedAlloc(u8, .@"16", default_page_size * 2 + 50);
lib/std/http/test.zig+2-2
......@@ -298,7 +298,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" {
298298 const response = try stream_reader.interface().allocRemaining(gpa, .unlimited);
299299 defer gpa.free(response);
300300
301 var expected_response = std.ArrayList(u8).init(gpa);
301 var expected_response = std.array_list.Managed(u8).init(gpa);
302302 defer expected_response.deinit();
303303
304304 try expected_response.appendSlice("HTTP/1.1 200 OK\r\nconnection: close\r\n\r\n");
......@@ -369,7 +369,7 @@ test "receiving arbitrary http headers from the client" {
369369 const response = try stream_reader.interface().allocRemaining(gpa, .unlimited);
370370 defer gpa.free(response);
371371
372 var expected_response = std.ArrayList(u8).init(gpa);
372 var expected_response = std.array_list.Managed(u8).init(gpa);
373373 defer expected_response.deinit();
374374
375375 try expected_response.appendSlice("HTTP/1.1 200 OK\r\n");
lib/std/json/Scanner.zig+7-8
......@@ -46,7 +46,6 @@ const Scanner = @This();
4646const std = @import("std");
4747
4848const Allocator = std.mem.Allocator;
49const ArrayList = std.ArrayList;
5049const assert = std.debug.assert;
5150const BitStack = std.BitStack;
5251
......@@ -136,7 +135,7 @@ pub fn nextAllocMax(self: *@This(), allocator: Allocator, when: AllocWhen, max_v
136135 };
137136 switch (token_type) {
138137 .number, .string => {
139 var value_list = ArrayList(u8).init(allocator);
138 var value_list = std.array_list.Managed(u8).init(allocator);
140139 errdefer {
141140 value_list.deinit();
142141 }
......@@ -173,7 +172,7 @@ pub fn nextAllocMax(self: *@This(), allocator: Allocator, when: AllocWhen, max_v
173172}
174173
175174/// Equivalent to `allocNextIntoArrayListMax(value_list, when, default_max_value_len);`
176pub fn allocNextIntoArrayList(self: *@This(), value_list: *ArrayList(u8), when: AllocWhen) AllocIntoArrayListError!?[]const u8 {
175pub fn allocNextIntoArrayList(self: *@This(), value_list: *std.array_list.Managed(u8), when: AllocWhen) AllocIntoArrayListError!?[]const u8 {
177176 return self.allocNextIntoArrayListMax(value_list, when, default_max_value_len);
178177}
179178/// The next token type must be either `.number` or `.string`. See `peekNextTokenType()`.
......@@ -186,7 +185,7 @@ pub fn allocNextIntoArrayList(self: *@This(), value_list: *ArrayList(u8), when:
186185/// can be resumed by passing the same array list in again.
187186/// This method does not indicate whether the token content being returned is for a `.number` or `.string` token type;
188187/// the caller of this method is expected to know which type of token is being processed.
189pub fn allocNextIntoArrayListMax(self: *@This(), value_list: *ArrayList(u8), when: AllocWhen, max_value_len: usize) AllocIntoArrayListError!?[]const u8 {
188pub fn allocNextIntoArrayListMax(self: *@This(), value_list: *std.array_list.Managed(u8), when: AllocWhen, max_value_len: usize) AllocIntoArrayListError!?[]const u8 {
190189 while (true) {
191190 const token = try self.next();
192191 switch (token) {
......@@ -1608,7 +1607,7 @@ pub const Reader = struct {
16081607 const token_type = try self.peekNextTokenType();
16091608 switch (token_type) {
16101609 .number, .string => {
1611 var value_list = ArrayList(u8).init(allocator);
1610 var value_list = std.array_list.Managed(u8).init(allocator);
16121611 errdefer {
16131612 value_list.deinit();
16141613 }
......@@ -1639,11 +1638,11 @@ pub const Reader = struct {
16391638 }
16401639
16411640 /// Equivalent to `allocNextIntoArrayListMax(value_list, when, default_max_value_len);`
1642 pub fn allocNextIntoArrayList(self: *@This(), value_list: *ArrayList(u8), when: AllocWhen) Reader.AllocError!?[]const u8 {
1641 pub fn allocNextIntoArrayList(self: *@This(), value_list: *std.array_list.Managed(u8), when: AllocWhen) Reader.AllocError!?[]const u8 {
16431642 return self.allocNextIntoArrayListMax(value_list, when, default_max_value_len);
16441643 }
16451644 /// Calls `std.json.Scanner.allocNextIntoArrayListMax` and handles `error.BufferUnderrun`.
1646 pub fn allocNextIntoArrayListMax(self: *@This(), value_list: *ArrayList(u8), when: AllocWhen, max_value_len: usize) Reader.AllocError!?[]const u8 {
1645 pub fn allocNextIntoArrayListMax(self: *@This(), value_list: *std.array_list.Managed(u8), when: AllocWhen, max_value_len: usize) Reader.AllocError!?[]const u8 {
16471646 while (true) {
16481647 return self.scanner.allocNextIntoArrayListMax(value_list, when, max_value_len) catch |err| switch (err) {
16491648 error.BufferUnderrun => {
......@@ -1746,7 +1745,7 @@ pub const Reader = struct {
17461745const OBJECT_MODE = 0;
17471746const ARRAY_MODE = 1;
17481747
1749fn appendSlice(list: *std.ArrayList(u8), buf: []const u8, max_value_len: usize) !void {
1748fn appendSlice(list: *std.array_list.Managed(u8), buf: []const u8, max_value_len: usize) !void {
17501749 const new_len = std.math.add(usize, list.items.len, buf.len) catch return error.ValueTooLong;
17511750 if (new_len > max_value_len) return error.ValueTooLong;
17521751 try list.appendSlice(buf);
lib/std/json/dynamic.zig+1-2
......@@ -1,7 +1,6 @@
11const std = @import("std");
22const debug = std.debug;
33const ArenaAllocator = std.heap.ArenaAllocator;
4const ArrayList = std.ArrayList;
54const StringArrayHashMap = std.StringArrayHashMap;
65const Allocator = std.mem.Allocator;
76const json = std.json;
......@@ -12,7 +11,7 @@ const ParseError = @import("./static.zig").ParseError;
1211const isNumberFormattedLikeAnInteger = @import("Scanner.zig").isNumberFormattedLikeAnInteger;
1312
1413pub const ObjectMap = StringArrayHashMap(Value);
15pub const Array = ArrayList(Value);
14pub const Array = std.array_list.Managed(Value);
1615
1716/// Represents any JSON value, potentially containing other JSON values.
1817/// A .float value may be an approximation of the original value.
lib/std/json/static.zig+1-1
......@@ -2,7 +2,7 @@ const std = @import("std");
22const assert = std.debug.assert;
33const Allocator = std.mem.Allocator;
44const ArenaAllocator = std.heap.ArenaAllocator;
5const ArrayList = std.ArrayList;
5const ArrayList = std.array_list.Managed;
66
77const Scanner = @import("Scanner.zig");
88const Token = Scanner.Token;
lib/std/math/big/int.zig+4-4
......@@ -1412,7 +1412,7 @@ pub const Mutable = struct {
14121412 ///
14131413 /// `limbs_buffer` is used for temporary storage during the operation. When this function returns,
14141414 /// it will have the same length as it had when the function was called.
1415 pub fn gcd(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.ArrayList(Limb)) !void {
1415 pub fn gcd(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.array_list.Managed(Limb)) !void {
14161416 const prev_len = limbs_buffer.items.len;
14171417 defer limbs_buffer.shrinkRetainingCapacity(prev_len);
14181418 const x_copy = if (rma.limbs.ptr == x.limbs.ptr) blk: {
......@@ -1538,13 +1538,13 @@ pub const Mutable = struct {
15381538 /// Asserts that `rma` has enough limbs to store the result. Upper bound is given by `calcGcdNoAliasLimbLen`.
15391539 ///
15401540 /// `limbs_buffer` is used for temporary storage during the operation.
1541 pub fn gcdNoAlias(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.ArrayList(Limb)) !void {
1541 pub fn gcdNoAlias(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.array_list.Managed(Limb)) !void {
15421542 assert(rma.limbs.ptr != x.limbs.ptr); // illegal aliasing
15431543 assert(rma.limbs.ptr != y.limbs.ptr); // illegal aliasing
15441544 return gcdLehmer(rma, x, y, limbs_buffer);
15451545 }
15461546
1547 fn gcdLehmer(result: *Mutable, xa: Const, ya: Const, limbs_buffer: *std.ArrayList(Limb)) !void {
1547 fn gcdLehmer(result: *Mutable, xa: Const, ya: Const, limbs_buffer: *std.array_list.Managed(Limb)) !void {
15481548 var x = try xa.toManaged(limbs_buffer.allocator);
15491549 defer x.deinit();
15501550 x.abs();
......@@ -3267,7 +3267,7 @@ pub const Managed = struct {
32673267 pub fn gcd(rma: *Managed, x: *const Managed, y: *const Managed) !void {
32683268 try rma.ensureCapacity(@min(x.len(), y.len()));
32693269 var m = rma.toMutable();
3270 var limbs_buffer = std.ArrayList(Limb).init(rma.allocator);
3270 var limbs_buffer = std.array_list.Managed(Limb).init(rma.allocator);
32713271 defer limbs_buffer.deinit();
32723272 try m.gcd(x.toConst(), y.toConst(), &limbs_buffer);
32733273 rma.setMetadata(m.positive, m.len);
lib/std/priority_dequeue.zig+1-1
......@@ -964,7 +964,7 @@ fn fuzzTestMinMax(rng: std.Random, queue_size: usize) !void {
964964}
965965
966966fn generateRandomSlice(allocator: std.mem.Allocator, rng: std.Random, size: usize) ![]u32 {
967 var array = std.ArrayList(u32).init(allocator);
967 var array = std.array_list.Managed(u32).init(allocator);
968968 try array.ensureTotalCapacity(size);
969969
970970 var i: usize = 0;
lib/std/process.zig+2-2
......@@ -1241,10 +1241,10 @@ pub fn argsAlloc(allocator: Allocator) ![][:0]u8 {
12411241 var it = try argsWithAllocator(allocator);
12421242 defer it.deinit();
12431243
1244 var contents = std.ArrayList(u8).init(allocator);
1244 var contents = std.array_list.Managed(u8).init(allocator);
12451245 defer contents.deinit();
12461246
1247 var slice_list = std.ArrayList(usize).init(allocator);
1247 var slice_list = std.array_list.Managed(usize).init(allocator);
12481248 defer slice_list.deinit();
12491249
12501250 while (it.next()) |arg| {
lib/std/process/Child.zig+3-3
......@@ -14,7 +14,7 @@ const assert = std.debug.assert;
1414const native_os = builtin.os.tag;
1515const Allocator = std.mem.Allocator;
1616const ChildProcess = @This();
17const ArrayList = std.ArrayListUnmanaged;
17const ArrayList = std.ArrayList;
1818
1919pub const Id = switch (native_os) {
2020 .windows => windows.HANDLE,
......@@ -1545,7 +1545,7 @@ fn argvToCommandLineWindows(
15451545 allocator: mem.Allocator,
15461546 argv: []const []const u8,
15471547) ArgvToCommandLineError![:0]u16 {
1548 var buf = std.ArrayList(u8).init(allocator);
1548 var buf = std.array_list.Managed(u8).init(allocator);
15491549 defer buf.deinit();
15501550
15511551 if (argv.len != 0) {
......@@ -1725,7 +1725,7 @@ fn argvToScriptCommandLineWindows(
17251725 /// Arguments, not including the script name itself. Expected to be encoded as WTF-8.
17261726 script_args: []const []const u8,
17271727) ArgvToScriptCommandLineError![:0]u16 {
1728 var buf = try std.ArrayList(u8).initCapacity(allocator, 64);
1728 var buf = try std.array_list.Managed(u8).initCapacity(allocator, 64);
17291729 defer buf.deinit();
17301730
17311731 // `/d` disables execution of AutoRun commands.
lib/std/std.zig+18-4
......@@ -1,9 +1,5 @@
11pub const ArrayHashMap = array_hash_map.ArrayHashMap;
22pub const ArrayHashMapUnmanaged = array_hash_map.ArrayHashMapUnmanaged;
3pub const ArrayList = @import("array_list.zig").ArrayList;
4pub const ArrayListAligned = @import("array_list.zig").ArrayListAligned;
5pub const ArrayListAlignedUnmanaged = @import("array_list.zig").ArrayListAlignedUnmanaged;
6pub const ArrayListUnmanaged = @import("array_list.zig").ArrayListUnmanaged;
73pub const AutoArrayHashMap = array_hash_map.AutoArrayHashMap;
84pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged;
95pub const AutoHashMap = hash_map.AutoHashMap;
......@@ -43,6 +39,24 @@ pub const Treap = @import("treap.zig").Treap;
4339pub const Tz = tz.Tz;
4440pub const Uri = @import("Uri.zig");
4541
42/// A contiguous, growable list of items in memory. This is a wrapper around a
43/// slice of `T` values.
44///
45/// The same allocator must be used throughout its entire lifetime. Initialize
46/// directly with `empty` or `initCapacity`, and deinitialize with `deinit` or
47/// `toOwnedSlice`.
48pub fn ArrayList(comptime T: type) type {
49 return array_list.Aligned(T, null);
50}
51pub const array_list = @import("array_list.zig");
52
53/// Deprecated; use `array_list.Aligned`.
54pub const ArrayListAligned = array_list.Aligned;
55/// Deprecated; use `array_list.Aligned`.
56pub const ArrayListAlignedUnmanaged = array_list.Aligned;
57/// Deprecated; use `ArrayList`.
58pub const ArrayListUnmanaged = ArrayList;
59
4660pub const array_hash_map = @import("array_hash_map.zig");
4761pub const atomic = @import("atomic.zig");
4862pub const base64 = @import("base64.zig");
lib/std/treap.zig+1-1
......@@ -641,7 +641,7 @@ test "node.{prev(),next()} with random data" {
641641
642642 var treap = TestTreap{};
643643 // A slow, stupid but correct reference. Ordered.
644 var golden = std.ArrayList(u64).init(std.testing.allocator);
644 var golden = std.array_list.Managed(u64).init(std.testing.allocator);
645645 defer golden.deinit();
646646
647647 // Insert.
lib/std/unicode.zig+21-21
......@@ -916,7 +916,7 @@ test fmtUtf8 {
916916}
917917
918918fn utf16LeToUtf8ArrayListImpl(
919 result: *std.ArrayList(u8),
919 result: *std.array_list.Managed(u8),
920920 utf16le: []const u16,
921921 comptime surrogates: Surrogates,
922922) (switch (surrogates) {
......@@ -967,7 +967,7 @@ fn utf16LeToUtf8ArrayListImpl(
967967
968968pub const Utf16LeToUtf8AllocError = mem.Allocator.Error || Utf16LeToUtf8Error;
969969
970pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) Utf16LeToUtf8AllocError!void {
970pub fn utf16LeToUtf8ArrayList(result: *std.array_list.Managed(u8), utf16le: []const u16) Utf16LeToUtf8AllocError!void {
971971 try result.ensureUnusedCapacity(utf16le.len);
972972 return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half);
973973}
......@@ -975,7 +975,7 @@ pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16)
975975/// Caller must free returned memory.
976976pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 {
977977 // optimistically guess that it will all be ascii.
978 var result = try std.ArrayList(u8).initCapacity(allocator, utf16le.len);
978 var result = try std.array_list.Managed(u8).initCapacity(allocator, utf16le.len);
979979 errdefer result.deinit();
980980
981981 try utf16LeToUtf8ArrayListImpl(&result, utf16le, .cannot_encode_surrogate_half);
......@@ -985,7 +985,7 @@ pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16L
985985/// Caller must free returned memory.
986986pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 {
987987 // optimistically guess that it will all be ascii (and allocate space for the null terminator)
988 var result = try std.ArrayList(u8).initCapacity(allocator, utf16le.len + 1);
988 var result = try std.array_list.Managed(u8).initCapacity(allocator, utf16le.len + 1);
989989 errdefer result.deinit();
990990
991991 try utf16LeToUtf8ArrayListImpl(&result, utf16le, .cannot_encode_surrogate_half);
......@@ -1117,7 +1117,7 @@ test utf16LeToUtf8 {
11171117 }
11181118}
11191119
1120fn utf8ToUtf16LeArrayListImpl(result: *std.ArrayList(u16), utf8: []const u8, comptime surrogates: Surrogates) !void {
1120fn utf8ToUtf16LeArrayListImpl(result: *std.array_list.Managed(u16), utf8: []const u8, comptime surrogates: Surrogates) !void {
11211121 assert(result.unusedCapacitySlice().len >= utf8.len);
11221122
11231123 var remaining = utf8;
......@@ -1155,14 +1155,14 @@ fn utf8ToUtf16LeArrayListImpl(result: *std.ArrayList(u16), utf8: []const u8, com
11551155 }
11561156}
11571157
1158pub fn utf8ToUtf16LeArrayList(result: *std.ArrayList(u16), utf8: []const u8) error{ InvalidUtf8, OutOfMemory }!void {
1158pub fn utf8ToUtf16LeArrayList(result: *std.array_list.Managed(u16), utf8: []const u8) error{ InvalidUtf8, OutOfMemory }!void {
11591159 try result.ensureUnusedCapacity(utf8.len);
11601160 return utf8ToUtf16LeArrayListImpl(result, utf8, .cannot_encode_surrogate_half);
11611161}
11621162
11631163pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![]u16 {
11641164 // optimistically guess that it will not require surrogate pairs
1165 var result = try std.ArrayList(u16).initCapacity(allocator, utf8.len);
1165 var result = try std.array_list.Managed(u16).initCapacity(allocator, utf8.len);
11661166 errdefer result.deinit();
11671167
11681168 try utf8ToUtf16LeArrayListImpl(&result, utf8, .cannot_encode_surrogate_half);
......@@ -1171,7 +1171,7 @@ pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ Inv
11711171
11721172pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 {
11731173 // optimistically guess that it will not require surrogate pairs
1174 var result = try std.ArrayList(u16).initCapacity(allocator, utf8.len + 1);
1174 var result = try std.array_list.Managed(u16).initCapacity(allocator, utf8.len + 1);
11751175 errdefer result.deinit();
11761176
11771177 try utf8ToUtf16LeArrayListImpl(&result, utf8, .cannot_encode_surrogate_half);
......@@ -1258,19 +1258,19 @@ test utf8ToUtf16Le {
12581258
12591259test utf8ToUtf16LeArrayList {
12601260 {
1261 var list = std.ArrayList(u16).init(testing.allocator);
1261 var list = std.array_list.Managed(u16).init(testing.allocator);
12621262 defer list.deinit();
12631263 try utf8ToUtf16LeArrayList(&list, "𐐷");
12641264 try testing.expectEqualSlices(u8, "\x01\xd8\x37\xdc", mem.sliceAsBytes(list.items));
12651265 }
12661266 {
1267 var list = std.ArrayList(u16).init(testing.allocator);
1267 var list = std.array_list.Managed(u16).init(testing.allocator);
12681268 defer list.deinit();
12691269 try utf8ToUtf16LeArrayList(&list, "\u{10FFFF}");
12701270 try testing.expectEqualSlices(u8, "\xff\xdb\xff\xdf", mem.sliceAsBytes(list.items));
12711271 }
12721272 {
1273 var list = std.ArrayList(u16).init(testing.allocator);
1273 var list = std.array_list.Managed(u16).init(testing.allocator);
12741274 defer list.deinit();
12751275 const result = utf8ToUtf16LeArrayList(&list, "\xf4\x90\x80\x80");
12761276 try testing.expectError(error.InvalidUtf8, result);
......@@ -1331,7 +1331,7 @@ test utf8ToUtf16LeAllocZ {
13311331test "ArrayList functions on a re-used list" {
13321332 // utf8ToUtf16LeArrayList
13331333 {
1334 var list = std.ArrayList(u16).init(testing.allocator);
1334 var list = std.array_list.Managed(u16).init(testing.allocator);
13351335 defer list.deinit();
13361336
13371337 const init_slice = utf8ToUtf16LeStringLiteral("abcdefg");
......@@ -1345,7 +1345,7 @@ test "ArrayList functions on a re-used list" {
13451345
13461346 // utf16LeToUtf8ArrayList
13471347 {
1348 var list = std.ArrayList(u8).init(testing.allocator);
1348 var list = std.array_list.Managed(u8).init(testing.allocator);
13491349 defer list.deinit();
13501350
13511351 const init_slice = "abcdefg";
......@@ -1359,7 +1359,7 @@ test "ArrayList functions on a re-used list" {
13591359
13601360 // wtf8ToWtf16LeArrayList
13611361 {
1362 var list = std.ArrayList(u16).init(testing.allocator);
1362 var list = std.array_list.Managed(u16).init(testing.allocator);
13631363 defer list.deinit();
13641364
13651365 const init_slice = utf8ToUtf16LeStringLiteral("abcdefg");
......@@ -1373,7 +1373,7 @@ test "ArrayList functions on a re-used list" {
13731373
13741374 // wtf16LeToWtf8ArrayList
13751375 {
1376 var list = std.ArrayList(u8).init(testing.allocator);
1376 var list = std.array_list.Managed(u8).init(testing.allocator);
13771377 defer list.deinit();
13781378
13791379 const init_slice = "abcdefg";
......@@ -1750,7 +1750,7 @@ pub const Wtf8Iterator = struct {
17501750 }
17511751};
17521752
1753pub fn wtf16LeToWtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) mem.Allocator.Error!void {
1753pub fn wtf16LeToWtf8ArrayList(result: *std.array_list.Managed(u8), utf16le: []const u16) mem.Allocator.Error!void {
17541754 try result.ensureUnusedCapacity(utf16le.len);
17551755 return utf16LeToUtf8ArrayListImpl(result, utf16le, .can_encode_surrogate_half);
17561756}
......@@ -1758,7 +1758,7 @@ pub fn wtf16LeToWtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16)
17581758/// Caller must free returned memory.
17591759pub fn wtf16LeToWtf8Alloc(allocator: mem.Allocator, wtf16le: []const u16) mem.Allocator.Error![]u8 {
17601760 // optimistically guess that it will all be ascii.
1761 var result = try std.ArrayList(u8).initCapacity(allocator, wtf16le.len);
1761 var result = try std.array_list.Managed(u8).initCapacity(allocator, wtf16le.len);
17621762 errdefer result.deinit();
17631763
17641764 try utf16LeToUtf8ArrayListImpl(&result, wtf16le, .can_encode_surrogate_half);
......@@ -1768,7 +1768,7 @@ pub fn wtf16LeToWtf8Alloc(allocator: mem.Allocator, wtf16le: []const u16) mem.Al
17681768/// Caller must free returned memory.
17691769pub fn wtf16LeToWtf8AllocZ(allocator: mem.Allocator, wtf16le: []const u16) mem.Allocator.Error![:0]u8 {
17701770 // optimistically guess that it will all be ascii (and allocate space for the null terminator)
1771 var result = try std.ArrayList(u8).initCapacity(allocator, wtf16le.len + 1);
1771 var result = try std.array_list.Managed(u8).initCapacity(allocator, wtf16le.len + 1);
17721772 errdefer result.deinit();
17731773
17741774 try utf16LeToUtf8ArrayListImpl(&result, wtf16le, .can_encode_surrogate_half);
......@@ -1779,14 +1779,14 @@ pub fn wtf16LeToWtf8(wtf8: []u8, wtf16le: []const u16) usize {
17791779 return utf16LeToUtf8Impl(wtf8, wtf16le, .can_encode_surrogate_half) catch |err| switch (err) {};
17801780}
17811781
1782pub fn wtf8ToWtf16LeArrayList(result: *std.ArrayList(u16), wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }!void {
1782pub fn wtf8ToWtf16LeArrayList(result: *std.array_list.Managed(u16), wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }!void {
17831783 try result.ensureUnusedCapacity(wtf8.len);
17841784 return utf8ToUtf16LeArrayListImpl(result, wtf8, .can_encode_surrogate_half);
17851785}
17861786
17871787pub fn wtf8ToWtf16LeAlloc(allocator: mem.Allocator, wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }![]u16 {
17881788 // optimistically guess that it will not require surrogate pairs
1789 var result = try std.ArrayList(u16).initCapacity(allocator, wtf8.len);
1789 var result = try std.array_list.Managed(u16).initCapacity(allocator, wtf8.len);
17901790 errdefer result.deinit();
17911791
17921792 try utf8ToUtf16LeArrayListImpl(&result, wtf8, .can_encode_surrogate_half);
......@@ -1795,7 +1795,7 @@ pub fn wtf8ToWtf16LeAlloc(allocator: mem.Allocator, wtf8: []const u8) error{ Inv
17951795
17961796pub fn wtf8ToWtf16LeAllocZ(allocator: mem.Allocator, wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }![:0]u16 {
17971797 // optimistically guess that it will not require surrogate pairs
1798 var result = try std.ArrayList(u16).initCapacity(allocator, wtf8.len + 1);
1798 var result = try std.array_list.Managed(u16).initCapacity(allocator, wtf8.len + 1);
17991799 errdefer result.deinit();
18001800
18011801 try utf8ToUtf16LeArrayListImpl(&result, wtf8, .can_encode_surrogate_half);
lib/std/zig.zig+6-6
......@@ -349,7 +349,7 @@ pub const LtoMode = enum { none, full, thin };
349349/// Renders a `std.Target.Cpu` value into a textual representation that can be parsed
350350/// via the `-mcpu` flag passed to the Zig compiler.
351351/// Appends the result to `buffer`.
352pub fn serializeCpu(buffer: *std.ArrayList(u8), cpu: std.Target.Cpu) Allocator.Error!void {
352pub fn serializeCpu(buffer: *std.array_list.Managed(u8), cpu: std.Target.Cpu) Allocator.Error!void {
353353 const all_features = cpu.arch.allFeaturesList();
354354 var populated_cpu_features = cpu.model.features;
355355 populated_cpu_features.populateDependencies(all_features);
......@@ -377,7 +377,7 @@ pub fn serializeCpu(buffer: *std.ArrayList(u8), cpu: std.Target.Cpu) Allocator.E
377377}
378378
379379pub fn serializeCpuAlloc(ally: Allocator, cpu: std.Target.Cpu) Allocator.Error![]u8 {
380 var buffer = std.ArrayList(u8).init(ally);
380 var buffer = std.array_list.Managed(u8).init(ally);
381381 try serializeCpu(&buffer, cpu);
382382 return buffer.toOwnedSlice();
383383}
......@@ -633,7 +633,7 @@ pub fn parseTargetQueryOrReportFatalError(
633633 return std.Target.Query.parse(opts_with_diags) catch |err| switch (err) {
634634 error.UnknownCpuModel => {
635635 help: {
636 var help_text = std.ArrayList(u8).init(allocator);
636 var help_text = std.array_list.Managed(u8).init(allocator);
637637 defer help_text.deinit();
638638 for (diags.arch.?.allCpuModels()) |cpu| {
639639 help_text.print(" {s}\n", .{cpu.name}) catch break :help;
......@@ -646,7 +646,7 @@ pub fn parseTargetQueryOrReportFatalError(
646646 },
647647 error.UnknownCpuFeature => {
648648 help: {
649 var help_text = std.ArrayList(u8).init(allocator);
649 var help_text = std.array_list.Managed(u8).init(allocator);
650650 defer help_text.deinit();
651651 for (diags.arch.?.allFeaturesList()) |feature| {
652652 help_text.print(" {s}: {s}\n", .{ feature.name, feature.description }) catch break :help;
......@@ -659,7 +659,7 @@ pub fn parseTargetQueryOrReportFatalError(
659659 },
660660 error.UnknownObjectFormat => {
661661 help: {
662 var help_text = std.ArrayList(u8).init(allocator);
662 var help_text = std.array_list.Managed(u8).init(allocator);
663663 defer help_text.deinit();
664664 inline for (@typeInfo(std.Target.ObjectFormat).@"enum".fields) |field| {
665665 help_text.print(" {s}\n", .{field.name}) catch break :help;
......@@ -670,7 +670,7 @@ pub fn parseTargetQueryOrReportFatalError(
670670 },
671671 error.UnknownArchitecture => {
672672 help: {
673 var help_text = std.ArrayList(u8).init(allocator);
673 var help_text = std.array_list.Managed(u8).init(allocator);
674674 defer help_text.deinit();
675675 inline for (@typeInfo(std.Target.Cpu.Arch).@"enum".fields) |field| {
676676 help_text.print(" {s}\n", .{field.name}) catch break :help;
lib/std/zig/Ast/Render.zig+2-2
......@@ -3456,8 +3456,8 @@ const AutoIndentingStream = struct {
34563456
34573457 indent_count: usize = 0,
34583458 indent_delta: usize,
3459 indent_stack: std.ArrayList(StackElem),
3460 space_stack: std.ArrayList(SpaceElem),
3459 indent_stack: std.array_list.Managed(StackElem),
3460 space_stack: std.array_list.Managed(SpaceElem),
34613461 space_mode: ?usize = null,
34623462 disable_indent_committing: usize = 0,
34633463 current_line_empty: bool = true,
lib/std/zig/AstGen.zig+1-1
......@@ -1784,7 +1784,7 @@ fn structInitExpr(
17841784 while (it.next()) |entry| {
17851785 const record = entry.value_ptr.*;
17861786 if (record.items.len > 1) {
1787 var error_notes = std.ArrayList(u32).init(astgen.arena);
1787 var error_notes = std.array_list.Managed(u32).init(astgen.arena);
17881788
17891789 for (record.items[1..]) |duplicate| {
17901790 try error_notes.append(try astgen.errNoteTok(duplicate, "duplicate name here", .{}));
lib/std/zig/LibCDirs.zig+2-2
......@@ -89,8 +89,8 @@ pub fn detect(
8989}
9090
9191fn detectFromInstallation(arena: Allocator, target: *const std.Target, lci: *const LibCInstallation) !LibCDirs {
92 var list = try std.ArrayList([]const u8).initCapacity(arena, 5);
93 var framework_list = std.ArrayList([]const u8).init(arena);
92 var list = try std.array_list.Managed([]const u8).initCapacity(arena, 5);
93 var framework_list = std.array_list.Managed([]const u8).init(arena);
9494
9595 list.appendAssumeCapacity(lci.include_dir.?);
9696
lib/std/zig/LibCInstallation.zig+7-7
......@@ -250,7 +250,7 @@ fn findNativeIncludeDirPosix(self: *LibCInstallation, args: FindNativeOptions) F
250250
251251 const dev_null = if (is_windows) "nul" else "/dev/null";
252252
253 var argv = std.ArrayList([]const u8).init(allocator);
253 var argv = std.array_list.Managed([]const u8).init(allocator);
254254 defer argv.deinit();
255255
256256 try appendCcExe(&argv, skip_cc_env_var);
......@@ -294,7 +294,7 @@ fn findNativeIncludeDirPosix(self: *LibCInstallation, args: FindNativeOptions) F
294294 }
295295
296296 var it = std.mem.tokenizeAny(u8, run_res.stderr, "\n\r");
297 var search_paths = std.ArrayList([]const u8).init(allocator);
297 var search_paths = std.array_list.Managed([]const u8).init(allocator);
298298 defer search_paths.deinit();
299299 while (it.next()) |line| {
300300 if (line.len != 0 and line[0] == ' ') {
......@@ -365,7 +365,7 @@ fn findNativeIncludeDirWindows(
365365 var install_buf: [2]std.zig.WindowsSdk.Installation = undefined;
366366 const installs = fillInstallations(&install_buf, sdk);
367367
368 var result_buf = std.ArrayList(u8).init(allocator);
368 var result_buf = std.array_list.Managed(u8).init(allocator);
369369 defer result_buf.deinit();
370370
371371 for (installs) |install| {
......@@ -404,7 +404,7 @@ fn findNativeCrtDirWindows(
404404 var install_buf: [2]std.zig.WindowsSdk.Installation = undefined;
405405 const installs = fillInstallations(&install_buf, sdk);
406406
407 var result_buf = std.ArrayList(u8).init(allocator);
407 var result_buf = std.array_list.Managed(u8).init(allocator);
408408 defer result_buf.deinit();
409409
410410 const arch_sub_dir = switch (args.target.cpu.arch) {
......@@ -471,7 +471,7 @@ fn findNativeKernel32LibDir(
471471 var install_buf: [2]std.zig.WindowsSdk.Installation = undefined;
472472 const installs = fillInstallations(&install_buf, sdk);
473473
474 var result_buf = std.ArrayList(u8).init(allocator);
474 var result_buf = std.array_list.Managed(u8).init(allocator);
475475 defer result_buf.deinit();
476476
477477 const arch_sub_dir = switch (args.target.cpu.arch) {
......@@ -578,7 +578,7 @@ fn ccPrintFileName(args: CCPrintFileNameOptions) ![:0]u8 {
578578 break :blk false;
579579 };
580580
581 var argv = std.ArrayList([]const u8).init(allocator);
581 var argv = std.array_list.Managed([]const u8).init(allocator);
582582 defer argv.deinit();
583583
584584 const arg1 = try std.fmt.allocPrint(allocator, "-print-file-name={s}", .{args.search_basename});
......@@ -671,7 +671,7 @@ fn fillInstallations(
671671
672672const inf_loop_env_key = "ZIG_IS_DETECTING_LIBC_PATHS";
673673
674fn appendCcExe(args: *std.ArrayList([]const u8), skip_cc_env_var: bool) !void {
674fn appendCcExe(args: *std.array_list.Managed([]const u8), skip_cc_env_var: bool) !void {
675675 const default_cc_exe = if (is_windows) "cc.exe" else "cc";
676676 try args.ensureUnusedCapacity(1);
677677 if (skip_cc_env_var) {
lib/std/zig/WindowsSdk.zig+10-10
......@@ -92,8 +92,8 @@ fn iterateAndFilterByVersion(
9292 std.mem.order(u8, lhs.build, rhs.build);
9393 }
9494 };
95 var versions = std.ArrayList(Version).init(allocator);
96 var dirs = std.ArrayList([]const u8).init(allocator);
95 var versions = std.array_list.Managed(Version).init(allocator);
96 var dirs = std.array_list.Managed([]const u8).init(allocator);
9797 defer {
9898 versions.deinit();
9999 for (dirs.items) |filtered_dir| allocator.free(filtered_dir);
......@@ -450,7 +450,7 @@ pub const Installation = struct {
450450 return error.PathTooLong;
451451 }
452452
453 var path = std.ArrayList(u8).fromOwnedSlice(allocator, path_maybe_with_trailing_slash);
453 var path = std.array_list.Managed(u8).fromOwnedSlice(allocator, path_maybe_with_trailing_slash);
454454 errdefer path.deinit();
455455
456456 // String might contain trailing slash, so trim it here
......@@ -522,7 +522,7 @@ pub const Installation = struct {
522522 return error.PathTooLong;
523523 }
524524
525 var path = std.ArrayList(u8).fromOwnedSlice(allocator, path_maybe_with_trailing_slash);
525 var path = std.array_list.Managed(u8).fromOwnedSlice(allocator, path_maybe_with_trailing_slash);
526526 errdefer path.deinit();
527527
528528 // String might contain trailing slash, so trim it here
......@@ -548,7 +548,7 @@ pub const Installation = struct {
548548 return error.VersionTooLong;
549549 }
550550
551 var version = std.ArrayList(u8).fromOwnedSlice(allocator, version_without_0);
551 var version = std.array_list.Managed(u8).fromOwnedSlice(allocator, version_without_0);
552552 errdefer version.deinit();
553553
554554 try version.appendSlice(".0");
......@@ -802,7 +802,7 @@ const MsvcLibDir = struct {
802802 }
803803
804804 fn libDirFromInstallationPath(allocator: std.mem.Allocator, installation_path: []const u8, arch: std.Target.Cpu.Arch) error{ OutOfMemory, PathNotFound }![]const u8 {
805 var lib_dir_buf = try std.ArrayList(u8).initCapacity(allocator, installation_path.len + 64);
805 var lib_dir_buf = try std.array_list.Managed(u8).initCapacity(allocator, installation_path.len + 64);
806806 errdefer lib_dir_buf.deinit();
807807
808808 lib_dir_buf.appendSliceAssumeCapacity(installation_path);
......@@ -897,7 +897,7 @@ const MsvcLibDir = struct {
897897 return error.PathNotFound;
898898 }
899899
900 var msvc_dir = std.ArrayList(u8).fromOwnedSlice(allocator, msvc_include_dir_maybe_with_trailing_slash);
900 var msvc_dir = std.array_list.Managed(u8).fromOwnedSlice(allocator, msvc_include_dir_maybe_with_trailing_slash);
901901 errdefer msvc_dir.deinit();
902902
903903 // String might contain trailing slash, so trim it here
......@@ -929,7 +929,7 @@ const MsvcLibDir = struct {
929929 }
930930
931931 fn findViaVs7Key(allocator: std.mem.Allocator, arch: std.Target.Cpu.Arch) error{ OutOfMemory, PathNotFound }![]const u8 {
932 var base_path: std.ArrayList(u8) = base_path: {
932 var base_path: std.array_list.Managed(u8) = base_path: {
933933 try_env: {
934934 var env_map = std.process.getEnvMap(allocator) catch |err| switch (err) {
935935 error.OutOfMemory => return error.OutOfMemory,
......@@ -940,7 +940,7 @@ const MsvcLibDir = struct {
940940 if (env_map.get("VS140COMNTOOLS")) |VS140COMNTOOLS| {
941941 if (VS140COMNTOOLS.len < "C:\\Common7\\Tools".len) break :try_env;
942942 if (!std.fs.path.isAbsolute(VS140COMNTOOLS)) break :try_env;
943 var list = std.ArrayList(u8).init(allocator);
943 var list = std.array_list.Managed(u8).init(allocator);
944944 errdefer list.deinit();
945945
946946 try list.appendSlice(VS140COMNTOOLS); // C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools
......@@ -964,7 +964,7 @@ const MsvcLibDir = struct {
964964 break :try_vs7_key;
965965 }
966966
967 var path = std.ArrayList(u8).fromOwnedSlice(allocator, path_maybe_with_trailing_slash);
967 var path = std.array_list.Managed(u8).fromOwnedSlice(allocator, path_maybe_with_trailing_slash);
968968 errdefer path.deinit();
969969
970970 // String might contain trailing slash, so trim it here
lib/std/zig/llvm/BitcodeReader.zig+3-3
......@@ -60,7 +60,7 @@ pub const Record = struct {
6060 blob: []const u8,
6161
6262 fn toOwnedAbbrev(record: Record, allocator: std.mem.Allocator) !Abbrev {
63 var operands = std.ArrayList(Abbrev.Operand).init(allocator);
63 var operands = std.array_list.Managed(Abbrev.Operand).init(allocator);
6464 defer operands.deinit();
6565
6666 assert(record.id == Abbrev.Builtin.define_abbrev.toRecordId());
......@@ -194,8 +194,8 @@ fn nextRecord(bc: *BitcodeReader) !?Record {
194194 defer bc.record_arena = record_arena.state;
195195 _ = record_arena.reset(.retain_capacity);
196196
197 var operands = try std.ArrayList(u64).initCapacity(record_arena.allocator(), abbrev.operands.len);
198 var blob = std.ArrayList(u8).init(record_arena.allocator());
197 var operands = try std.array_list.Managed(u64).initCapacity(record_arena.allocator(), abbrev.operands.len);
198 var blob = std.array_list.Managed(u8).init(record_arena.allocator());
199199 for (abbrev.operands, 0..) |abbrev_operand, abbrev_operand_i| switch (abbrev_operand) {
200200 .literal => |value| operands.appendAssumeCapacity(value),
201201 .encoding => |abbrev_encoding| switch (abbrev_encoding) {
lib/std/zig/llvm/Builder.zig+2-2
......@@ -9107,7 +9107,7 @@ pub fn getIntrinsic(
91079107
91089108 var attributes: struct {
91099109 builder: *Builder,
9110 list: std.ArrayList(Attribute.Index),
9110 list: std.array_list.Managed(Attribute.Index),
91119111
91129112 fn deinit(state: *@This()) void {
91139113 state.list.deinit();
......@@ -9120,7 +9120,7 @@ pub fn getIntrinsic(
91209120 item.* = try state.builder.attr(attribute);
91219121 return state.builder.attrs(state.list.items);
91229122 }
9123 } = .{ .builder = self, .list = std.ArrayList(Attribute.Index).init(allocator) };
9123 } = .{ .builder = self, .list = std.array_list.Managed(Attribute.Index).init(allocator) };
91249124 defer attributes.deinit();
91259125
91269126 var overload_index: usize = 0;
lib/std/zig/llvm/bitcode_writer.zig+2-2
......@@ -19,7 +19,7 @@ pub fn BitcodeWriter(comptime types: []const type) type {
1919 return struct {
2020 const BcWriter = @This();
2121
22 buffer: std.ArrayList(u32),
22 buffer: std.array_list.Managed(u32),
2323 bit_buffer: u32 = 0,
2424 bit_count: u5 = 0,
2525
......@@ -31,7 +31,7 @@ pub fn BitcodeWriter(comptime types: []const type) type {
3131
3232 pub fn init(allocator: std.mem.Allocator, widths: [types.len]u16) BcWriter {
3333 return .{
34 .buffer = std.ArrayList(u32).init(allocator),
34 .buffer = std.array_list.Managed(u32).init(allocator),
3535 .widths = widths,
3636 };
3737 }
src/Builtin.zig+2-2
......@@ -40,12 +40,12 @@ pub fn hash(opts: @This()) [std.Build.Cache.bin_digest_len]u8 {
4040}
4141
4242pub fn generate(opts: @This(), allocator: Allocator) Allocator.Error![:0]u8 {
43 var buffer = std.ArrayList(u8).init(allocator);
43 var buffer = std.array_list.Managed(u8).init(allocator);
4444 try append(opts, &buffer);
4545 return buffer.toOwnedSliceSentinel(0);
4646}
4747
48pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
48pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Error!void {
4949 const target = opts.target;
5050 const arch_family_name = @tagName(target.cpu.arch.family());
5151 const zig_backend = opts.zig_backend;
src/Compilation.zig+9-9
......@@ -3644,10 +3644,10 @@ pub fn saveState(comp: *Compilation) !void {
36443644
36453645 const gpa = comp.gpa;
36463646
3647 var bufs = std.ArrayList([]const u8).init(gpa);
3647 var bufs = std.array_list.Managed([]const u8).init(gpa);
36483648 defer bufs.deinit();
36493649
3650 var pt_headers = std.ArrayList(Header.PerThread).init(gpa);
3650 var pt_headers = std.array_list.Managed(Header.PerThread).init(gpa);
36513651 defer pt_headers.deinit();
36523652
36533653 if (comp.zcu) |zcu| {
......@@ -3865,7 +3865,7 @@ pub fn saveState(comp: *Compilation) !void {
38653865 try af.finish();
38663866}
38673867
3868fn addBuf(list: *std.ArrayList([]const u8), buf: []const u8) void {
3868fn addBuf(list: *std.array_list.Managed([]const u8), buf: []const u8) void {
38693869 if (buf.len == 0) return;
38703870 list.appendAssumeCapacity(buf);
38713871}
......@@ -5657,7 +5657,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module
56575657 log.info("C import source: {s}", .{out_h_path});
56585658 }
56595659
5660 var argv = std.ArrayList([]const u8).init(comp.gpa);
5660 var argv = std.array_list.Managed([]const u8).init(comp.gpa);
56615661 defer argv.deinit();
56625662
56635663 try argv.append(@tagName(comp.config.c_frontend)); // argv[0] is program name, actual args start at [1]
......@@ -6113,7 +6113,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
61136113 const target = comp.getTarget();
61146114 const o_ext = target.ofmt.fileExt(target.cpu.arch);
61156115 const digest = if (!comp.disable_c_depfile and try man.hit()) man.final() else blk: {
6116 var argv = std.ArrayList([]const u8).init(gpa);
6116 var argv = std.array_list.Managed([]const u8).init(gpa);
61176117 defer argv.deinit();
61186118
61196119 // In case we are doing passthrough mode, we need to detect -S and -emit-llvm.
......@@ -6458,7 +6458,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
64586458
64596459 try o_dir.writeFile(.{ .sub_path = rc_basename, .data = input });
64606460
6461 var argv = std.ArrayList([]const u8).init(comp.gpa);
6461 var argv = std.array_list.Managed([]const u8).init(comp.gpa);
64626462 defer argv.deinit();
64636463
64646464 try argv.appendSlice(&.{
......@@ -6515,7 +6515,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
65156515 // so we need a temporary filename.
65166516 const out_res_path = try comp.tmpFilePath(arena, res_filename);
65176517
6518 var argv = std.ArrayList([]const u8).init(comp.gpa);
6518 var argv = std.array_list.Managed([]const u8).init(comp.gpa);
65196519 defer argv.deinit();
65206520
65216521 const depfile_filename = try std.fmt.allocPrint(arena, "{s}.d.json", .{rc_basename_noext});
......@@ -6698,7 +6698,7 @@ pub fn tmpFilePath(comp: Compilation, ally: Allocator, suffix: []const u8) error
66986698pub fn addTranslateCCArgs(
66996699 comp: *Compilation,
67006700 arena: Allocator,
6701 argv: *std.ArrayList([]const u8),
6701 argv: *std.array_list.Managed([]const u8),
67026702 ext: FileExt,
67036703 out_dep_path: ?[]const u8,
67046704 owner_mod: *Package.Module,
......@@ -6713,7 +6713,7 @@ pub fn addTranslateCCArgs(
67136713pub fn addCCArgs(
67146714 comp: *const Compilation,
67156715 arena: Allocator,
6716 argv: *std.ArrayList([]const u8),
6716 argv: *std.array_list.Managed([]const u8),
67176717 ext: FileExt,
67186718 out_dep_path: ?[]const u8,
67196719 mod: *Package.Module,
src/Package/Fetch.zig+4-4
......@@ -173,7 +173,7 @@ pub const JobQueue = struct {
173173
174174 /// Creates the dependencies.zig source code for the build runner to obtain
175175 /// via `@import("@dependencies")`.
176 pub fn createDependenciesSource(jq: *JobQueue, buf: *std.ArrayList(u8)) Allocator.Error!void {
176 pub fn createDependenciesSource(jq: *JobQueue, buf: *std.array_list.Managed(u8)) Allocator.Error!void {
177177 const keys = jq.table.keys();
178178
179179 assert(keys.len != 0); // caller should have added the first one
......@@ -285,7 +285,7 @@ pub const JobQueue = struct {
285285 try buf.appendSlice("};\n");
286286 }
287287
288 pub fn createEmptyDependenciesSource(buf: *std.ArrayList(u8)) Allocator.Error!void {
288 pub fn createEmptyDependenciesSource(buf: *std.array_list.Managed(u8)) Allocator.Error!void {
289289 try buf.appendSlice(
290290 \\pub const packages = struct {};
291291 \\pub const root_deps: []const struct { []const u8, []const u8 } = &.{};
......@@ -1474,10 +1474,10 @@ fn computeHash(f: *Fetch, pkg_path: Cache.Path, filter: Filter) RunError!Compute
14741474 const root_dir = pkg_path.root_dir.handle;
14751475
14761476 // Collect all files, recursively, then sort.
1477 var all_files = std.ArrayList(*HashedFile).init(gpa);
1477 var all_files = std.array_list.Managed(*HashedFile).init(gpa);
14781478 defer all_files.deinit();
14791479
1480 var deleted_files = std.ArrayList(*DeletedFile).init(gpa);
1480 var deleted_files = std.array_list.Managed(*DeletedFile).init(gpa);
14811481 defer deleted_files.deinit();
14821482
14831483 // Track directories which had any files deleted from them so that empty directories
src/Package/Module.zig+2-2
......@@ -336,8 +336,8 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
336336 if (resolved_target.llvm_cpu_features) |x| break :b x;
337337 if (!options.global.use_llvm) break :b null;
338338
339 var buf = std.ArrayList(u8).init(arena);
340 var disabled_features = std.ArrayList(u8).init(arena);
339 var buf = std.array_list.Managed(u8).init(arena);
340 var disabled_features = std.array_list.Managed(u8).init(arena);
341341 defer disabled_features.deinit();
342342
343343 // Append disabled features after enabled ones, so that their effects aren't overwritten.
src/RangeSet.zig+2-2
......@@ -10,7 +10,7 @@ const RangeSet = @This();
1010const LazySrcLoc = Zcu.LazySrcLoc;
1111
1212zcu: *Zcu,
13ranges: std.ArrayList(Range),
13ranges: std.array_list.Managed(Range),
1414
1515pub const Range = struct {
1616 first: InternPool.Index,
......@@ -21,7 +21,7 @@ pub const Range = struct {
2121pub fn init(allocator: std.mem.Allocator, zcu: *Zcu) RangeSet {
2222 return .{
2323 .zcu = zcu,
24 .ranges = std.ArrayList(Range).init(allocator),
24 .ranges = std.array_list.Managed(Range).init(allocator),
2525 };
2626}
2727
src/Sema.zig+9-9
......@@ -63,7 +63,7 @@ func_index: InternPool.Index,
6363func_is_naked: bool,
6464/// Used to restore the error return trace when returning a non-error from a function.
6565error_return_trace_index_on_fn_entry: Air.Inst.Ref = .none,
66comptime_err_ret_trace: *std.ArrayList(LazySrcLoc),
66comptime_err_ret_trace: *std.array_list.Managed(LazySrcLoc),
6767/// When semantic analysis needs to know the return type of the function whose body
6868/// is being analyzed, this `Type` should be used instead of going through `func`.
6969/// This will correctly handle the case of a comptime/inline function call of a
......@@ -376,7 +376,7 @@ pub const Block = struct {
376376 /// What mode to generate float operations in, set by @setFloatMode
377377 float_mode: std.builtin.FloatMode = .strict,
378378
379 c_import_buf: ?*std.ArrayList(u8) = null,
379 c_import_buf: ?*std.array_list.Managed(u8) = null,
380380
381381 /// If not `null`, this boolean is set when a `dbg_var_ptr`, `dbg_var_val`, or `dbg_arg_inline`.
382382 /// instruction is emitted. It signals that the innermost lexically
......@@ -3931,7 +3931,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref,
39313931
39323932 // Whilst constructing our mapping, we will also initialize optional and error union payloads when
39333933 // we encounter the corresponding pointers. For this reason, the ordering of `to_map` matters.
3934 var to_map = try std.ArrayList(Air.Inst.Index).initCapacity(sema.arena, stores.len);
3934 var to_map = try std.array_list.Managed(Air.Inst.Index).initCapacity(sema.arena, stores.len);
39353935
39363936 for (stores) |store_inst_idx| {
39373937 const store_inst = sema.air_instructions.get(@intFromEnum(store_inst_idx));
......@@ -5665,7 +5665,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr
56655665 if (!build_options.have_llvm)
56665666 return sema.fail(parent_block, src, "C import unavailable; Zig compiler built without LLVM extensions", .{});
56675667
5668 var c_import_buf = std.ArrayList(u8).init(gpa);
5668 var c_import_buf = std.array_list.Managed(u8).init(gpa);
56695669 defer c_import_buf.deinit();
56705670
56715671 var child_block: Block = .{
......@@ -10701,7 +10701,7 @@ const SwitchProngAnalysis = struct {
1070110701 const prong_count = field_indices.len - in_mem_coercible.count();
1070210702
1070310703 const estimated_extra = prong_count * 6 + (prong_count / 10); // 2 for Case, 1 item, probably 3 insts; plus hints
10704 var cases_extra = try std.ArrayList(u32).initCapacity(sema.gpa, estimated_extra);
10704 var cases_extra = try std.array_list.Managed(u32).initCapacity(sema.gpa, estimated_extra);
1070510705 defer cases_extra.deinit();
1070610706
1070710707 {
......@@ -17603,7 +17603,7 @@ fn typeInfoDecls(
1760317603
1760417604 const declaration_ty = try sema.getBuiltinType(src, .@"Type.Declaration");
1760517605
17606 var decl_vals = std.ArrayList(InternPool.Index).init(gpa);
17606 var decl_vals = std.array_list.Managed(InternPool.Index).init(gpa);
1760717607 defer decl_vals.deinit();
1760817608
1760917609 var seen_namespaces = std.AutoHashMap(*Namespace, void).init(gpa);
......@@ -17645,7 +17645,7 @@ fn typeInfoNamespaceDecls(
1764517645 sema: *Sema,
1764617646 opt_namespace_index: InternPool.OptionalNamespaceIndex,
1764717647 declaration_ty: Type,
17648 decl_vals: *std.ArrayList(InternPool.Index),
17648 decl_vals: *std.array_list.Managed(InternPool.Index),
1764917649 seen_namespaces: *std.AutoHashMap(*Namespace, void),
1765017650) !void {
1765117651 const pt = sema.pt;
......@@ -29670,7 +29670,7 @@ fn coerceInMemoryAllowedErrorSets(
2967029670 }
2967129671 }
2967229672
29673 var missing_error_buf = std.ArrayList(InternPool.NullTerminatedString).init(gpa);
29673 var missing_error_buf = std.array_list.Managed(InternPool.NullTerminatedString).init(gpa);
2967429674 defer missing_error_buf.deinit();
2967529675
2967629676 switch (src_ty.toIntern()) {
......@@ -37151,7 +37151,7 @@ pub fn resolveDeclaredEnum(
3715137151 var arena: std.heap.ArenaAllocator = .init(gpa);
3715237152 defer arena.deinit();
3715337153
37154 var comptime_err_ret_trace: std.ArrayList(Zcu.LazySrcLoc) = .init(gpa);
37154 var comptime_err_ret_trace: std.array_list.Managed(Zcu.LazySrcLoc) = .init(gpa);
3715537155 defer comptime_err_ret_trace.deinit();
3715637156
3715737157 var sema: Sema = .{
src/Sema/bitcast.zig+3-3
......@@ -102,7 +102,7 @@ fn bitCastInner(
102102 .arena = sema.arena,
103103 .skip_bits = skip_bits,
104104 .remaining_bits = dest_ty.bitSize(zcu),
105 .unpacked = std.ArrayList(InternPool.Index).init(sema.arena),
105 .unpacked = std.array_list.Managed(InternPool.Index).init(sema.arena),
106106 };
107107 switch (endian) {
108108 .little => {
......@@ -163,7 +163,7 @@ fn bitCastSpliceInner(
163163 .arena = sema.arena,
164164 .skip_bits = 0,
165165 .remaining_bits = splice_offset,
166 .unpacked = std.ArrayList(InternPool.Index).init(sema.arena),
166 .unpacked = std.array_list.Managed(InternPool.Index).init(sema.arena),
167167 };
168168 switch (endian) {
169169 .little => {
......@@ -216,7 +216,7 @@ const UnpackValueBits = struct {
216216 skip_bits: u64,
217217 remaining_bits: u64,
218218 extra_bits: u64 = undefined,
219 unpacked: std.ArrayList(InternPool.Index),
219 unpacked: std.array_list.Managed(InternPool.Index),
220220
221221 fn add(unpack: *UnpackValueBits, val: Value) BitCastError!void {
222222 const pt = unpack.pt;
src/Type.zig+2-2
......@@ -3805,7 +3805,7 @@ fn resolveStructInner(
38053805 var analysis_arena = std.heap.ArenaAllocator.init(gpa);
38063806 defer analysis_arena.deinit();
38073807
3808 var comptime_err_ret_trace = std.ArrayList(Zcu.LazySrcLoc).init(gpa);
3808 var comptime_err_ret_trace = std.array_list.Managed(Zcu.LazySrcLoc).init(gpa);
38093809 defer comptime_err_ret_trace.deinit();
38103810
38113811 const zir = zcu.namespacePtr(struct_obj.namespace).fileScope(zcu).zir.?;
......@@ -3864,7 +3864,7 @@ fn resolveUnionInner(
38643864 var analysis_arena = std.heap.ArenaAllocator.init(gpa);
38653865 defer analysis_arena.deinit();
38663866
3867 var comptime_err_ret_trace = std.ArrayList(Zcu.LazySrcLoc).init(gpa);
3867 var comptime_err_ret_trace = std.array_list.Managed(Zcu.LazySrcLoc).init(gpa);
38683868 defer comptime_err_ret_trace.deinit();
38693869
38703870 const zir = zcu.namespacePtr(union_obj.namespace).fileScope(zcu).zir.?;
src/Zcu/PerThread.zig+5-5
......@@ -727,7 +727,7 @@ fn analyzeMemoizedState(pt: Zcu.PerThread, stage: InternPool.MemoizedStateStage)
727727 var analysis_arena: std.heap.ArenaAllocator = .init(gpa);
728728 defer analysis_arena.deinit();
729729
730 var comptime_err_ret_trace: std.ArrayList(Zcu.LazySrcLoc) = .init(gpa);
730 var comptime_err_ret_trace: std.array_list.Managed(Zcu.LazySrcLoc) = .init(gpa);
731731 defer comptime_err_ret_trace.deinit();
732732
733733 var sema: Sema = .{
......@@ -870,7 +870,7 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu
870870 var analysis_arena: std.heap.ArenaAllocator = .init(gpa);
871871 defer analysis_arena.deinit();
872872
873 var comptime_err_ret_trace: std.ArrayList(Zcu.LazySrcLoc) = .init(gpa);
873 var comptime_err_ret_trace: std.array_list.Managed(Zcu.LazySrcLoc) = .init(gpa);
874874 defer comptime_err_ret_trace.deinit();
875875
876876 var sema: Sema = .{
......@@ -1097,7 +1097,7 @@ fn analyzeNavVal(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileErr
10971097 var analysis_arena: std.heap.ArenaAllocator = .init(gpa);
10981098 defer analysis_arena.deinit();
10991099
1100 var comptime_err_ret_trace: std.ArrayList(Zcu.LazySrcLoc) = .init(gpa);
1100 var comptime_err_ret_trace: std.array_list.Managed(Zcu.LazySrcLoc) = .init(gpa);
11011101 defer comptime_err_ret_trace.deinit();
11021102
11031103 var sema: Sema = .{
......@@ -1471,7 +1471,7 @@ fn analyzeNavType(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileEr
14711471 var analysis_arena: std.heap.ArenaAllocator = .init(gpa);
14721472 defer analysis_arena.deinit();
14731473
1474 var comptime_err_ret_trace: std.ArrayList(Zcu.LazySrcLoc) = .init(gpa);
1474 var comptime_err_ret_trace: std.array_list.Managed(Zcu.LazySrcLoc) = .init(gpa);
14751475 defer comptime_err_ret_trace.deinit();
14761476
14771477 var sema: Sema = .{
......@@ -2807,7 +2807,7 @@ fn analyzeFnBodyInner(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaE
28072807 var analysis_arena = std.heap.ArenaAllocator.init(gpa);
28082808 defer analysis_arena.deinit();
28092809
2810 var comptime_err_ret_trace = std.ArrayList(Zcu.LazySrcLoc).init(gpa);
2810 var comptime_err_ret_trace = std.array_list.Managed(Zcu.LazySrcLoc).init(gpa);
28112811 defer comptime_err_ret_trace.deinit();
28122812
28132813 // In the case of a generic function instance, this is the type of the
src/arch/riscv64/CodeGen.zig+5-5
......@@ -101,7 +101,7 @@ reused_operands: std.StaticBitSet(Air.Liveness.bpi - 1) = undefined,
101101/// within different branches. Special consideration is needed when a branch
102102/// joins with its parent, to make sure all instructions have the same MCValue
103103/// across each runtime branch upon joining.
104branch_stack: *std.ArrayList(Branch),
104branch_stack: *std.array_list.Managed(Branch),
105105
106106// Currently set vector properties, null means they haven't been set yet in the function.
107107avl: ?u64,
......@@ -674,7 +674,7 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt
674674 var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) =
675675 if (opts.update_tracking) {} else std.heap.stackFallback(@sizeOf(ExpectedContents), func.gpa);
676676
677 var reg_locks = if (opts.update_tracking) {} else try std.ArrayList(RegisterLock).initCapacity(
677 var reg_locks = if (opts.update_tracking) {} else try std.array_list.Managed(RegisterLock).initCapacity(
678678 stack.get(),
679679 @typeInfo(ExpectedContents).array.len,
680680 );
......@@ -753,7 +753,7 @@ pub fn generate(
753753 const fn_type = Type.fromInterned(func.ty);
754754 const mod = zcu.navFileScope(func.owner_nav).mod.?;
755755
756 var branch_stack = std.ArrayList(Branch).init(gpa);
756 var branch_stack = std.array_list.Managed(Branch).init(gpa);
757757 defer {
758758 assert(branch_stack.items.len == 1);
759759 branch_stack.items[0].deinit(gpa);
......@@ -4883,7 +4883,7 @@ fn genCall(
48834883 stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align);
48844884 }
48854885
4886 var reg_locks = std.ArrayList(?RegisterLock).init(allocator);
4886 var reg_locks = std.array_list.Managed(?RegisterLock).init(allocator);
48874887 defer reg_locks.deinit();
48884888 try reg_locks.ensureTotalCapacity(8);
48894889 defer for (reg_locks.items) |reg_lock| if (reg_lock) |lock| func.register_manager.unlockReg(lock);
......@@ -6056,7 +6056,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
60566056 extra_i += inputs.len;
60576057
60586058 var result: MCValue = .none;
6059 var args = std.ArrayList(MCValue).init(func.gpa);
6059 var args = std.array_list.Managed(MCValue).init(func.gpa);
60606060 try args.ensureTotalCapacity(outputs.len + inputs.len);
60616061 defer {
60626062 for (args.items) |arg| if (arg.getReg()) |reg| func.register_manager.unlockReg(.{
src/arch/sparc64/CodeGen.zig+2-2
......@@ -88,7 +88,7 @@ reused_operands: std.StaticBitSet(Air.Liveness.bpi - 1) = undefined,
8888/// within different branches. Special consideration is needed when a branch
8989/// joins with its parent, to make sure all instructions have the same MCValue
9090/// across each runtime branch upon joining.
91branch_stack: *std.ArrayList(Branch),
91branch_stack: *std.array_list.Managed(Branch),
9292
9393// Key is the block instruction
9494blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
......@@ -276,7 +276,7 @@ pub fn generate(
276276 const file_scope = zcu.navFileScope(func.owner_nav);
277277 const target = &file_scope.mod.?.resolved_target.result;
278278
279 var branch_stack = std.ArrayList(Branch).init(gpa);
279 var branch_stack = std.array_list.Managed(Branch).init(gpa);
280280 defer {
281281 assert(branch_stack.items.len == 1);
282282 branch_stack.items[0].deinit(gpa);
src/arch/wasm/CodeGen.zig+2-2
......@@ -1301,7 +1301,7 @@ fn resolveCallingConventionValues(
13011301 };
13021302 if (cc == .naked) return result;
13031303
1304 var args = std.ArrayList(WValue).init(gpa);
1304 var args = std.array_list.Managed(WValue).init(gpa);
13051305 defer args.deinit();
13061306
13071307 // Check if we store the result as a pointer to the stack rather than
......@@ -7132,7 +7132,7 @@ fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
71327132 const result = try cg.allocLocal(Type.bool);
71337133
71347134 const names = error_set_ty.errorSetNames(zcu);
7135 var values = try std.ArrayList(u32).initCapacity(cg.gpa, names.len);
7135 var values = try std.array_list.Managed(u32).initCapacity(cg.gpa, names.len);
71367136 defer values.deinit();
71377137
71387138 var lowest: ?u32 = null;
src/arch/x86_64/CodeGen.zig+3-3
......@@ -169359,7 +169359,7 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co
169359169359 var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) =
169360169360 if (opts.update_tracking) {} else std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa);
169361169361
169362 var reg_locks = if (opts.update_tracking) {} else try std.ArrayList(RegisterLock).initCapacity(
169362 var reg_locks = if (opts.update_tracking) {} else try std.array_list.Managed(RegisterLock).initCapacity(
169363169363 stack.get(),
169364169364 @typeInfo(ExpectedContents).array.len,
169365169365 );
......@@ -178175,7 +178175,7 @@ fn genCall(self: *CodeGen, info: union(enum) {
178175178175 const frame_indices = try allocator.alloc(FrameIndex, args.len);
178176178176 defer allocator.free(frame_indices);
178177178177
178178 var reg_locks: std.ArrayList(?RegisterLock) = .init(allocator);
178178 var reg_locks: std.array_list.Managed(?RegisterLock) = .init(allocator);
178179178179 defer reg_locks.deinit();
178180178180 try reg_locks.ensureTotalCapacity(16);
178181178181 defer for (reg_locks.items) |reg_lock| if (reg_lock) |lock| self.register_manager.unlockReg(lock);
......@@ -179786,7 +179786,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void {
179786179786 extra_i += inputs.len;
179787179787
179788179788 var result: MCValue = .none;
179789 var args: std.ArrayList(MCValue) = .init(self.gpa);
179789 var args: std.array_list.Managed(MCValue) = .init(self.gpa);
179790179790 try args.ensureTotalCapacity(outputs.len + inputs.len);
179791179791 defer {
179792179792 for (args.items) |arg| if (arg.getReg()) |reg| self.register_manager.unlockReg(.{
src/arch/x86_64/encoder.zig+5-5
......@@ -1216,7 +1216,7 @@ const TestEncode = struct {
12161216};
12171217
12181218test "encode" {
1219 var buf = std.ArrayList(u8).init(testing.allocator);
1219 var buf = std.array_list.Managed(u8).init(testing.allocator);
12201220 defer buf.deinit();
12211221
12221222 const inst: Instruction = try .new(.none, .mov, &.{
......@@ -2647,7 +2647,7 @@ test "assemble" {
26472647 // zig fmt: on
26482648
26492649 var as = Assembler.init(input);
2650 var output = std.ArrayList(u8).init(testing.allocator);
2650 var output = std.array_list.Managed(u8).init(testing.allocator);
26512651 defer output.deinit();
26522652 try as.assemble(output.writer());
26532653 try expectEqualHexStrings(expected, output.items, input);
......@@ -2691,7 +2691,7 @@ test "assemble - Jcc" {
26912691 const input = @tagName(mnemonic[0]) ++ " 0x0";
26922692 const expected = [_]u8{ 0x0f, mnemonic[1], 0x0, 0x0, 0x0, 0x0 };
26932693 var as = Assembler.init(input);
2694 var output = std.ArrayList(u8).init(testing.allocator);
2694 var output = std.array_list.Managed(u8).init(testing.allocator);
26952695 defer output.deinit();
26962696 try as.assemble(output.writer());
26972697 try expectEqualHexStrings(&expected, output.items, input);
......@@ -2736,7 +2736,7 @@ test "assemble - SETcc" {
27362736 const input = @tagName(mnemonic[0]) ++ " al";
27372737 const expected = [_]u8{ 0x0f, mnemonic[1], 0xC0 };
27382738 var as = Assembler.init(input);
2739 var output = std.ArrayList(u8).init(testing.allocator);
2739 var output = std.array_list.Managed(u8).init(testing.allocator);
27402740 defer output.deinit();
27412741 try as.assemble(output.writer());
27422742 try expectEqualHexStrings(&expected, output.items, input);
......@@ -2781,7 +2781,7 @@ test "assemble - CMOVcc" {
27812781 const input = @tagName(mnemonic[0]) ++ " rax, rbx";
27822782 const expected = [_]u8{ 0x48, 0x0f, mnemonic[1], 0xC3 };
27832783 var as = Assembler.init(input);
2784 var output = std.ArrayList(u8).init(testing.allocator);
2784 var output = std.array_list.Managed(u8).init(testing.allocator);
27852785 defer output.deinit();
27862786 try as.assemble(output.writer());
27872787 try expectEqualHexStrings(&expected, output.items, input);
src/codegen/llvm.zig+5-5
......@@ -53,7 +53,7 @@ fn subArchName(target: *const std.Target, comptime family: std.Target.Cpu.Arch.F
5353}
5454
5555pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 {
56 var llvm_triple = std.ArrayList(u8).init(allocator);
56 var llvm_triple = std.array_list.Managed(u8).init(allocator);
5757 defer llvm_triple.deinit();
5858
5959 const llvm_arch = switch (target.cpu.arch) {
......@@ -820,7 +820,7 @@ pub const Object = struct {
820820 }
821821
822822 {
823 var module_flags = try std.ArrayList(Builder.Metadata).initCapacity(o.gpa, 8);
823 var module_flags = try std.array_list.Managed(Builder.Metadata).initCapacity(o.gpa, 8);
824824 defer module_flags.deinit();
825825
826826 const behavior_error = try o.builder.metadataConstant(try o.builder.intConst(.i32, 1));
......@@ -2583,7 +2583,7 @@ pub const Object = struct {
25832583 .@"fn" => {
25842584 const fn_info = zcu.typeToFunc(ty).?;
25852585
2586 var debug_param_types = std.ArrayList(Builder.Metadata).init(gpa);
2586 var debug_param_types = std.array_list.Managed(Builder.Metadata).init(gpa);
25872587 defer debug_param_types.deinit();
25882588
25892589 try debug_param_types.ensureUnusedCapacity(3 + fn_info.param_types.len);
......@@ -5254,7 +5254,7 @@ pub const FuncGen = struct {
52545254 const target = zcu.getTarget();
52555255 const sret = firstParamSRet(fn_info, zcu, target);
52565256
5257 var llvm_args = std.ArrayList(Builder.Value).init(self.gpa);
5257 var llvm_args = std.array_list.Managed(Builder.Value).init(self.gpa);
52585258 defer llvm_args.deinit();
52595259
52605260 var attributes: Builder.FunctionAttributes.Wip = .{};
......@@ -7536,7 +7536,7 @@ pub const FuncGen = struct {
75367536 const asm_source = std.mem.sliceAsBytes(self.air.extra.items[extra_i..])[0..extra.data.source_len];
75377537
75387538 // hackety hacks until stage2 has proper inline asm in the frontend.
7539 var rendered_template = std.ArrayList(u8).init(gpa);
7539 var rendered_template = std.array_list.Managed(u8).init(gpa);
75407540 defer rendered_template.deinit();
75417541
75427542 const State = enum { start, percent, input, modifier };
src/codegen/spirv/CodeGen.zig+5-5
......@@ -970,10 +970,10 @@ fn constant(cg: *CodeGen, ty: Type, val: Value, repr: Repr) Error!Id {
970970 return try cg.constInt(backing_ty, @as(u64, @bitCast(limbs)));
971971 }
972972
973 var types = std.ArrayList(Type).init(gpa);
973 var types = std.array_list.Managed(Type).init(gpa);
974974 defer types.deinit();
975975
976 var constituents = std.ArrayList(Id).init(gpa);
976 var constituents = std.array_list.Managed(Id).init(gpa);
977977 defer constituents.deinit();
978978
979979 var it = struct_type.iterateRuntimeOrder(ip);
......@@ -1519,13 +1519,13 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id {
15191519 return try cg.resolveType(.fromInterned(struct_type.backingIntTypeUnordered(ip)), .direct);
15201520 }
15211521
1522 var member_types = std.ArrayList(Id).init(gpa);
1522 var member_types = std.array_list.Managed(Id).init(gpa);
15231523 defer member_types.deinit();
15241524
1525 var member_names = std.ArrayList([]const u8).init(gpa);
1525 var member_names = std.array_list.Managed([]const u8).init(gpa);
15261526 defer member_names.deinit();
15271527
1528 var member_offsets = std.ArrayList(u32).init(gpa);
1528 var member_offsets = std.array_list.Managed(u32).init(gpa);
15291529 defer member_offsets.deinit();
15301530
15311531 var it = struct_type.iterateRuntimeOrder(ip);
src/codegen/spirv/Module.zig+2-2
......@@ -281,7 +281,7 @@ pub fn addEntryPointDeps(
281281 module: *Module,
282282 decl_index: Decl.Index,
283283 seen: *std.DynamicBitSetUnmanaged,
284 interface: *std.ArrayList(Id),
284 interface: *std.array_list.Managed(Id),
285285) !void {
286286 const decl = module.declPtr(decl_index);
287287 const deps = module.decl_deps.items[decl.begin_dep..decl.end_dep];
......@@ -307,7 +307,7 @@ fn entryPoints(module: *Module) !Section {
307307 var entry_points = Section{};
308308 errdefer entry_points.deinit(module.gpa);
309309
310 var interface = std.ArrayList(Id).init(module.gpa);
310 var interface = std.array_list.Managed(Id).init(module.gpa);
311311 defer interface.deinit();
312312
313313 var seen = try std.DynamicBitSetUnmanaged.initEmpty(module.gpa, module.decls.items.len);
src/fmt.zig+2-2
......@@ -46,9 +46,9 @@ pub fn run(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
4646 var check_flag = false;
4747 var check_ast_flag = false;
4848 var force_zon = false;
49 var input_files = std.ArrayList([]const u8).init(gpa);
49 var input_files = std.array_list.Managed([]const u8).init(gpa);
5050 defer input_files.deinit();
51 var excluded_files = std.ArrayList([]const u8).init(gpa);
51 var excluded_files = std.array_list.Managed([]const u8).init(gpa);
5252 defer excluded_files.deinit();
5353
5454 {
src/libs/freebsd.zig+5-5
......@@ -76,7 +76,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
7676
7777 switch (crt_file) {
7878 .scrt1_o => {
79 var cflags = std.ArrayList([]const u8).init(arena);
79 var cflags = std.array_list.Managed([]const u8).init(arena);
8080 try cflags.appendSlice(&.{
8181 "-O2",
8282 "-fno-common",
......@@ -89,7 +89,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
8989 try cflags.append("-mlongcall");
9090 }
9191
92 var acflags = std.ArrayList([]const u8).init(arena);
92 var acflags = std.array_list.Managed([]const u8).init(arena);
9393 try acflags.appendSlice(&.{
9494 "-DLOCORE",
9595 // See `Compilation.addCCArgs`.
......@@ -510,7 +510,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
510510 };
511511
512512 {
513 var map_contents = std.ArrayList(u8).init(arena);
513 var map_contents = std.array_list.Managed(u8).init(arena);
514514 for (metadata.all_versions[0 .. target_ver_index + 1]) |ver| {
515515 try map_contents.writer().print("FBSD_{d}.{d} {{ }};\n", .{ ver.major, ver.minor });
516516 }
......@@ -518,7 +518,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
518518 map_contents.deinit();
519519 }
520520
521 var stubs_asm = std.ArrayList(u8).init(gpa);
521 var stubs_asm = std.array_list.Managed(u8).init(gpa);
522522 defer stubs_asm.deinit();
523523
524524 for (libs, 0..) |lib, lib_i| {
......@@ -529,7 +529,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
529529 try stubs_writer.writeAll(".text\n");
530530
531531 var sym_i: usize = 0;
532 var sym_name_buf = std.ArrayList(u8).init(arena);
532 var sym_name_buf = std.array_list.Managed(u8).init(arena);
533533 var opt_symbol_name: ?[]const u8 = null;
534534 var versions = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len);
535535 var weak_linkages = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len);
src/libs/glibc.zig+9-9
......@@ -186,7 +186,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
186186 switch (crt_file) {
187187 .scrt1_o => {
188188 const start_o: Compilation.CSourceFile = blk: {
189 var args = std.ArrayList([]const u8).init(arena);
189 var args = std.array_list.Managed([]const u8).init(arena);
190190 try add_include_dirs(comp, arena, &args);
191191 try args.appendSlice(&[_][]const u8{
192192 "-D_LIBC_REENTRANT",
......@@ -210,7 +210,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
210210 };
211211 };
212212 const abi_note_o: Compilation.CSourceFile = blk: {
213 var args = std.ArrayList([]const u8).init(arena);
213 var args = std.array_list.Managed([]const u8).init(arena);
214214 try args.appendSlice(&[_][]const u8{
215215 "-I",
216216 try lib_path(comp, arena, lib_libc_glibc ++ "csu"),
......@@ -306,7 +306,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
306306 for (deps) |dep| {
307307 if (!dep.include) continue;
308308
309 var args = std.ArrayList([]const u8).init(arena);
309 var args = std.array_list.Managed([]const u8).init(arena);
310310 try args.appendSlice(&[_][]const u8{
311311 "-std=gnu11",
312312 "-fgnu89-inline",
......@@ -364,7 +364,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
364364
365365 const s = path.sep_str;
366366
367 var result = std.ArrayList(u8).init(arena);
367 var result = std.array_list.Managed(u8).init(arena);
368368 try result.appendSlice(comp.dirs.zig_lib.path orelse ".");
369369 try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s);
370370 if (is_sparc) {
......@@ -408,7 +408,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
408408 return result.items;
409409}
410410
411fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void {
411fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.array_list.Managed([]const u8)) error{OutOfMemory}!void {
412412 const target = comp.getTarget();
413413 const opt_nptl: ?[]const u8 = if (target.os.tag == .linux) "nptl" else "htl";
414414
......@@ -484,7 +484,7 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([
484484
485485fn add_include_dirs_arch(
486486 arena: Allocator,
487 args: *std.ArrayList([]const u8),
487 args: *std.array_list.Managed([]const u8),
488488 target: *const std.Target,
489489 opt_nptl: ?[]const u8,
490490 dir: []const u8,
......@@ -749,7 +749,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
749749 };
750750
751751 {
752 var map_contents = std.ArrayList(u8).init(arena);
752 var map_contents = std.array_list.Managed(u8).init(arena);
753753 for (metadata.all_versions[0 .. target_ver_index + 1]) |ver| {
754754 if (ver.patch == 0) {
755755 try map_contents.writer().print("GLIBC_{d}.{d} {{ }};\n", .{ ver.major, ver.minor });
......@@ -761,7 +761,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
761761 map_contents.deinit(); // The most recent allocation of an arena can be freed :)
762762 }
763763
764 var stubs_asm = std.ArrayList(u8).init(gpa);
764 var stubs_asm = std.array_list.Managed(u8).init(gpa);
765765 defer stubs_asm.deinit();
766766
767767 for (libs, 0..) |lib, lib_i| {
......@@ -773,7 +773,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
773773 try stubs_asm.appendSlice(".text\n");
774774
775775 var sym_i: usize = 0;
776 var sym_name_buf = std.ArrayList(u8).init(arena);
776 var sym_name_buf = std.array_list.Managed(u8).init(arena);
777777 var opt_symbol_name: ?[]const u8 = null;
778778 var versions_buffer: [32]u8 = undefined;
779779 var versions_len: usize = undefined;
src/libs/libcxx.zig+7-7
......@@ -190,7 +190,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
190190 else
191191 &libcxx_base_files;
192192
193 var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len);
193 var c_source_files = try std.array_list.Managed(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len);
194194
195195 for (libcxx_files) |cxx_src| {
196196 // These don't compile on WASI due to e.g. `fchmod` usage.
......@@ -201,7 +201,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
201201 if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos)
202202 continue;
203203
204 var cflags = std.ArrayList([]const u8).init(arena);
204 var cflags = std.array_list.Managed([]const u8).init(arena);
205205
206206 try addCxxArgs(comp, arena, &cflags);
207207
......@@ -233,7 +233,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
233233 // These depend on only the zig lib directory file path, which is
234234 // purposefully either in the cache or not in the cache. The decision
235235 // should not be overridden here.
236 var cache_exempt_flags = std.ArrayList([]const u8).init(arena);
236 var cache_exempt_flags = std.array_list.Managed([]const u8).init(arena);
237237
238238 try cache_exempt_flags.append("-I");
239239 try cache_exempt_flags.append(cxx_include_path);
......@@ -385,7 +385,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
385385 return error.AlreadyReported;
386386 };
387387
388 var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len);
388 var c_source_files = try std.array_list.Managed(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len);
389389
390390 for (libcxxabi_files) |cxxabi_src| {
391391 if (!comp.config.any_non_single_threaded and std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp"))
......@@ -394,7 +394,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
394394 (std.mem.eql(u8, cxxabi_src, "src/cxa_exception.cpp") or std.mem.eql(u8, cxxabi_src, "src/cxa_personality.cpp")))
395395 continue;
396396
397 var cflags = std.ArrayList([]const u8).init(arena);
397 var cflags = std.array_list.Managed([]const u8).init(arena);
398398
399399 try addCxxArgs(comp, arena, &cflags);
400400
......@@ -425,7 +425,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
425425 // These depend on only the zig lib directory file path, which is
426426 // purposefully either in the cache or not in the cache. The decision
427427 // should not be overridden here.
428 var cache_exempt_flags = std.ArrayList([]const u8).init(arena);
428 var cache_exempt_flags = std.array_list.Managed([]const u8).init(arena);
429429
430430 try cache_exempt_flags.append("-I");
431431 try cache_exempt_flags.append(cxxabi_include_path);
......@@ -497,7 +497,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
497497pub fn addCxxArgs(
498498 comp: *const Compilation,
499499 arena: std.mem.Allocator,
500 cflags: *std.ArrayList([]const u8),
500 cflags: *std.array_list.Managed([]const u8),
501501) error{OutOfMemory}!void {
502502 const target = comp.getTarget();
503503 const optimize_mode = comp.compilerRtOptMode();
src/libs/libtsan.zig+9-9
......@@ -113,12 +113,12 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
113113 return error.AlreadyReported;
114114 };
115115
116 var c_source_files = std.ArrayList(Compilation.CSourceFile).init(arena);
116 var c_source_files = std.array_list.Managed(Compilation.CSourceFile).init(arena);
117117 try c_source_files.ensureUnusedCapacity(tsan_sources.len);
118118
119119 const tsan_include_path = try comp.dirs.zig_lib.join(arena, &.{"libtsan"});
120120 for (tsan_sources) |tsan_src| {
121 var cflags = std.ArrayList([]const u8).init(arena);
121 var cflags = std.array_list.Managed([]const u8).init(arena);
122122
123123 try cflags.append("-I");
124124 try cflags.append(tsan_include_path);
......@@ -139,7 +139,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
139139 };
140140 try c_source_files.ensureUnusedCapacity(platform_tsan_sources.len);
141141 for (platform_tsan_sources) |tsan_src| {
142 var cflags = std.ArrayList([]const u8).init(arena);
142 var cflags = std.array_list.Managed([]const u8).init(arena);
143143
144144 try cflags.append("-I");
145145 try cflags.append(tsan_include_path);
......@@ -163,7 +163,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
163163 .x86_64 => "tsan_rtl_amd64.S",
164164 else => return error.TSANUnsupportedCPUArchitecture,
165165 };
166 var cflags = std.ArrayList([]const u8).init(arena);
166 var cflags = std.array_list.Managed([]const u8).init(arena);
167167
168168 try cflags.append("-I");
169169 try cflags.append(tsan_include_path);
......@@ -182,7 +182,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
182182 "libtsan", "sanitizer_common",
183183 });
184184 for (sanitizer_common_sources) |common_src| {
185 var cflags = std.ArrayList([]const u8).init(arena);
185 var cflags = std.array_list.Managed([]const u8).init(arena);
186186
187187 try cflags.append("-I");
188188 try cflags.append(sanitizer_common_include_path);
......@@ -206,7 +206,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
206206 &sanitizer_nolibc_sources;
207207 try c_source_files.ensureUnusedCapacity(to_c_or_not_to_c_sources.len);
208208 for (to_c_or_not_to_c_sources) |c_src| {
209 var cflags = std.ArrayList([]const u8).init(arena);
209 var cflags = std.array_list.Managed([]const u8).init(arena);
210210
211211 try cflags.append("-I");
212212 try cflags.append(sanitizer_common_include_path);
......@@ -226,7 +226,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
226226
227227 try c_source_files.ensureUnusedCapacity(sanitizer_symbolizer_sources.len);
228228 for (sanitizer_symbolizer_sources) |c_src| {
229 var cflags = std.ArrayList([]const u8).init(arena);
229 var cflags = std.array_list.Managed([]const u8).init(arena);
230230
231231 try cflags.append("-I");
232232 try cflags.append(tsan_include_path);
......@@ -246,7 +246,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
246246
247247 try c_source_files.ensureUnusedCapacity(interception_sources.len);
248248 for (interception_sources) |c_src| {
249 var cflags = std.ArrayList([]const u8).init(arena);
249 var cflags = std.array_list.Managed([]const u8).init(arena);
250250
251251 try cflags.append("-I");
252252 try cflags.append(interception_include_path);
......@@ -323,7 +323,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
323323 comp.tsan_lib = crt_file;
324324}
325325
326fn addCcArgs(target: *const std.Target, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void {
326fn addCcArgs(target: *const std.Target, args: *std.array_list.Managed([]const u8)) error{OutOfMemory}!void {
327327 try args.appendSlice(&[_][]const u8{
328328 "-nostdinc++",
329329 "-fvisibility=hidden",
src/libs/libunwind.zig+1-1
......@@ -87,7 +87,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
8787 const root_name = "unwind";
8888 var c_source_files: [unwind_src_list.len]Compilation.CSourceFile = undefined;
8989 for (unwind_src_list, 0..) |unwind_src, i| {
90 var cflags = std.ArrayList([]const u8).init(arena);
90 var cflags = std.array_list.Managed([]const u8).init(arena);
9191
9292 switch (Compilation.classifyFileExt(unwind_src)) {
9393 .c => {
src/libs/mingw.zig+8-8
......@@ -33,7 +33,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
3333
3434 switch (crt_file) {
3535 .crt2_o => {
36 var args = std.ArrayList([]const u8).init(arena);
36 var args = std.array_list.Managed([]const u8).init(arena);
3737 try addCrtCcArgs(comp, arena, &args);
3838 if (comp.mingw_unicode_entry_point) {
3939 try args.appendSlice(&.{ "-DUNICODE", "-D_UNICODE" });
......@@ -53,7 +53,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
5353 },
5454
5555 .dllcrt2_o => {
56 var args = std.ArrayList([]const u8).init(arena);
56 var args = std.array_list.Managed([]const u8).init(arena);
5757 try addCrtCcArgs(comp, arena, &args);
5858 var files = [_]Compilation.CSourceFile{
5959 .{
......@@ -70,10 +70,10 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
7070 },
7171
7272 .libmingw32_lib => {
73 var c_source_files = std.ArrayList(Compilation.CSourceFile).init(arena);
73 var c_source_files = std.array_list.Managed(Compilation.CSourceFile).init(arena);
7474
7575 {
76 var crt_args = std.ArrayList([]const u8).init(arena);
76 var crt_args = std.array_list.Managed([]const u8).init(arena);
7777 try addCrtCcArgs(comp, arena, &crt_args);
7878
7979 for (mingw32_generic_src) |dep| {
......@@ -150,7 +150,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
150150 }
151151
152152 {
153 var winpthreads_args = std.ArrayList([]const u8).init(arena);
153 var winpthreads_args = std.array_list.Managed([]const u8).init(arena);
154154 try addCcArgs(comp, arena, &winpthreads_args);
155155 try winpthreads_args.appendSlice(&[_][]const u8{
156156 "-DIN_WINPTHREAD",
......@@ -186,7 +186,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
186186fn addCcArgs(
187187 comp: *Compilation,
188188 arena: Allocator,
189 args: *std.ArrayList([]const u8),
189 args: *std.array_list.Managed([]const u8),
190190) error{OutOfMemory}!void {
191191 try args.appendSlice(&[_][]const u8{
192192 "-std=gnu11",
......@@ -200,7 +200,7 @@ fn addCcArgs(
200200fn addCrtCcArgs(
201201 comp: *Compilation,
202202 arena: Allocator,
203 args: *std.ArrayList([]const u8),
203 args: *std.array_list.Managed([]const u8),
204204) error{OutOfMemory}!void {
205205 try addCcArgs(comp, arena, args);
206206
......@@ -401,7 +401,7 @@ fn findDef(
401401 else => unreachable,
402402 };
403403
404 var override_path = std.ArrayList(u8).init(allocator);
404 var override_path = std.array_list.Managed(u8).init(allocator);
405405 defer override_path.deinit();
406406
407407 const s = path.sep_str;
src/libs/musl.zig+7-7
......@@ -29,7 +29,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
2929
3030 switch (in_crt_file) {
3131 .crt1_o => {
32 var args = std.ArrayList([]const u8).init(arena);
32 var args = std.array_list.Managed([]const u8).init(arena);
3333 try addCcArgs(comp, arena, &args, false);
3434 try args.append("-DCRT");
3535 var files = [_]Compilation.CSourceFile{
......@@ -49,7 +49,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
4949 });
5050 },
5151 .rcrt1_o => {
52 var args = std.ArrayList([]const u8).init(arena);
52 var args = std.array_list.Managed([]const u8).init(arena);
5353 try addCcArgs(comp, arena, &args, false);
5454 try args.append("-DCRT");
5555 var files = [_]Compilation.CSourceFile{
......@@ -70,7 +70,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
7070 });
7171 },
7272 .scrt1_o => {
73 var args = std.ArrayList([]const u8).init(arena);
73 var args = std.array_list.Managed([]const u8).init(arena);
7474 try addCcArgs(comp, arena, &args, false);
7575 try args.append("-DCRT");
7676 var files = [_]Compilation.CSourceFile{
......@@ -112,10 +112,10 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
112112 }
113113 }
114114
115 var c_source_files = std.ArrayList(Compilation.CSourceFile).init(comp.gpa);
115 var c_source_files = std.array_list.Managed(Compilation.CSourceFile).init(comp.gpa);
116116 defer c_source_files.deinit();
117117
118 var override_path = std.ArrayList(u8).init(comp.gpa);
118 var override_path = std.array_list.Managed(u8).init(comp.gpa);
119119 defer override_path.deinit();
120120
121121 const s = path.sep_str;
......@@ -161,7 +161,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
161161 continue;
162162 }
163163
164 var args = std.ArrayList([]const u8).init(arena);
164 var args = std.array_list.Managed([]const u8).init(arena);
165165 try addCcArgs(comp, arena, &args, ext == .o3);
166166 const c_source_file = try c_source_files.addOne();
167167 c_source_file.* = .{
......@@ -390,7 +390,7 @@ fn addSrcFile(arena: Allocator, source_table: *std.StringArrayHashMap(Ext), file
390390fn addCcArgs(
391391 comp: *Compilation,
392392 arena: Allocator,
393 args: *std.ArrayList([]const u8),
393 args: *std.array_list.Managed([]const u8),
394394 want_O3: bool,
395395) error{OutOfMemory}!void {
396396 const target = comp.getTarget();
src/libs/netbsd.zig+4-4
......@@ -69,13 +69,13 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
6969
7070 switch (crt_file) {
7171 .scrt0_o => {
72 var cflags = std.ArrayList([]const u8).init(arena);
72 var cflags = std.array_list.Managed([]const u8).init(arena);
7373 try cflags.appendSlice(&.{
7474 "-DHAVE_INITFINI_ARRAY",
7575 "-w", // Disable all warnings.
7676 });
7777
78 var acflags = std.ArrayList([]const u8).init(arena);
78 var acflags = std.array_list.Managed([]const u8).init(arena);
7979 try acflags.appendSlice(&.{
8080 // See `Compilation.addCCArgs`.
8181 try std.fmt.allocPrint(arena, "-D__NetBSD_Version__={d}", .{(target_version.major * 100_000_000) + (target_version.minor * 1_000_000)}),
......@@ -454,7 +454,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
454454 break :blk latest_index;
455455 };
456456
457 var stubs_asm = std.ArrayList(u8).init(gpa);
457 var stubs_asm = std.array_list.Managed(u8).init(gpa);
458458 defer stubs_asm.deinit();
459459
460460 for (libs, 0..) |lib, lib_i| {
......@@ -465,7 +465,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
465465 try stubs_writer.writeAll(".text\n");
466466
467467 var sym_i: usize = 0;
468 var sym_name_buf = std.ArrayList(u8).init(arena);
468 var sym_name_buf = std.array_list.Managed(u8).init(arena);
469469 var opt_symbol_name: ?[]const u8 = null;
470470
471471 var inc_fbs = std.io.fixedBufferStream(metadata.inclusions);
src/libs/wasi_libc.zig+15-15
......@@ -41,7 +41,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
4141
4242 switch (crt_file) {
4343 .crt1_reactor_o => {
44 var args = std.ArrayList([]const u8).init(arena);
44 var args = std.array_list.Managed([]const u8).init(arena);
4545 try addCCArgs(comp, arena, &args, .{});
4646 try addLibcBottomHalfIncludes(comp, arena, &args);
4747 var files = [_]Compilation.CSourceFile{
......@@ -56,7 +56,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
5656 return comp.build_crt_file("crt1-reactor", .Obj, .@"wasi crt1-reactor.o", prog_node, &files, .{});
5757 },
5858 .crt1_command_o => {
59 var args = std.ArrayList([]const u8).init(arena);
59 var args = std.array_list.Managed([]const u8).init(arena);
6060 try addCCArgs(comp, arena, &args, .{});
6161 try addLibcBottomHalfIncludes(comp, arena, &args);
6262 var files = [_]Compilation.CSourceFile{
......@@ -71,11 +71,11 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
7171 return comp.build_crt_file("crt1-command", .Obj, .@"wasi crt1-command.o", prog_node, &files, .{});
7272 },
7373 .libc_a => {
74 var libc_sources = std.ArrayList(Compilation.CSourceFile).init(arena);
74 var libc_sources = std.array_list.Managed(Compilation.CSourceFile).init(arena);
7575
7676 {
7777 // Compile emmalloc.
78 var args = std.ArrayList([]const u8).init(arena);
78 var args = std.array_list.Managed([]const u8).init(arena);
7979 try addCCArgs(comp, arena, &args, .{ .want_O3 = true, .no_strict_aliasing = true });
8080 for (emmalloc_src_files) |file_path| {
8181 try libc_sources.append(.{
......@@ -90,7 +90,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
9090
9191 {
9292 // Compile libc-bottom-half.
93 var args = std.ArrayList([]const u8).init(arena);
93 var args = std.array_list.Managed([]const u8).init(arena);
9494 try addCCArgs(comp, arena, &args, .{ .want_O3 = true });
9595 try addLibcBottomHalfIncludes(comp, arena, &args);
9696
......@@ -107,7 +107,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
107107
108108 {
109109 // Compile libc-top-half.
110 var args = std.ArrayList([]const u8).init(arena);
110 var args = std.array_list.Managed([]const u8).init(arena);
111111 try addCCArgs(comp, arena, &args, .{ .want_O3 = true });
112112 try addLibcTopHalfIncludes(comp, arena, &args);
113113
......@@ -124,7 +124,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
124124
125125 {
126126 // Compile libdl.
127 var args = std.ArrayList([]const u8).init(arena);
127 var args = std.array_list.Managed([]const u8).init(arena);
128128 try addCCArgs(comp, arena, &args, .{ .want_O3 = true });
129129 try addLibcBottomHalfIncludes(comp, arena, &args);
130130
......@@ -141,7 +141,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
141141
142142 {
143143 // Compile libwasi-emulated-process-clocks.
144 var args = std.ArrayList([]const u8).init(arena);
144 var args = std.array_list.Managed([]const u8).init(arena);
145145 try addCCArgs(comp, arena, &args, .{ .want_O3 = true });
146146 try args.appendSlice(&.{
147147 "-I",
......@@ -167,7 +167,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
167167
168168 {
169169 // Compile libwasi-emulated-getpid.
170 var args = std.ArrayList([]const u8).init(arena);
170 var args = std.array_list.Managed([]const u8).init(arena);
171171 try addCCArgs(comp, arena, &args, .{ .want_O3 = true });
172172 try addLibcBottomHalfIncludes(comp, arena, &args);
173173
......@@ -184,7 +184,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
184184
185185 {
186186 // Compile libwasi-emulated-mman.
187 var args = std.ArrayList([]const u8).init(arena);
187 var args = std.array_list.Managed([]const u8).init(arena);
188188 try addCCArgs(comp, arena, &args, .{ .want_O3 = true });
189189 try addLibcBottomHalfIncludes(comp, arena, &args);
190190
......@@ -201,7 +201,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
201201
202202 {
203203 // Compile libwasi-emulated-signal.
204 var bottom_args = std.ArrayList([]const u8).init(arena);
204 var bottom_args = std.array_list.Managed([]const u8).init(arena);
205205 try addCCArgs(comp, arena, &bottom_args, .{ .want_O3 = true });
206206
207207 for (emulated_signal_bottom_half_src_files) |file_path| {
......@@ -214,7 +214,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
214214 });
215215 }
216216
217 var top_args = std.ArrayList([]const u8).init(arena);
217 var top_args = std.array_list.Managed([]const u8).init(arena);
218218 try addCCArgs(comp, arena, &top_args, .{ .want_O3 = true });
219219 try addLibcTopHalfIncludes(comp, arena, &top_args);
220220 try top_args.append("-D_WASI_EMULATED_SIGNAL");
......@@ -259,7 +259,7 @@ const CCOptions = struct {
259259fn addCCArgs(
260260 comp: *Compilation,
261261 arena: Allocator,
262 args: *std.ArrayList([]const u8),
262 args: *std.array_list.Managed([]const u8),
263263 options: CCOptions,
264264) error{OutOfMemory}!void {
265265 const target = comp.getTarget();
......@@ -298,7 +298,7 @@ fn addCCArgs(
298298fn addLibcBottomHalfIncludes(
299299 comp: *Compilation,
300300 arena: Allocator,
301 args: *std.ArrayList([]const u8),
301 args: *std.array_list.Managed([]const u8),
302302) error{OutOfMemory}!void {
303303 try args.appendSlice(&[_][]const u8{
304304 "-I",
......@@ -370,7 +370,7 @@ fn addLibcBottomHalfIncludes(
370370fn addLibcTopHalfIncludes(
371371 comp: *Compilation,
372372 arena: Allocator,
373 args: *std.ArrayList([]const u8),
373 args: *std.array_list.Managed([]const u8),
374374) error{OutOfMemory}!void {
375375 try args.appendSlice(&[_][]const u8{
376376 "-I",
src/link.zig+1-1
......@@ -166,7 +166,7 @@ pub const Diags = struct {
166166 ) Allocator.Error!void {
167167 const gpa = diags.gpa;
168168
169 var context_lines = std.ArrayList([]const u8).init(gpa);
169 var context_lines = std.array_list.Managed([]const u8).init(gpa);
170170 defer context_lines.deinit();
171171
172172 var current_err: ?*Lld = null;
src/link/C.zig+1-1
......@@ -766,7 +766,7 @@ pub fn flushEmitH(zcu: *Zcu) !void {
766766
767767 // We collect a list of buffers to write, and write them all at once with pwritev 😎
768768 const num_buffers = emit_h.decl_table.count() + 1;
769 var all_buffers = try std.ArrayList(std.posix.iovec_const).initCapacity(zcu.gpa, num_buffers);
769 var all_buffers = try std.array_list.Managed(std.posix.iovec_const).initCapacity(zcu.gpa, num_buffers);
770770 defer all_buffers.deinit();
771771
772772 var file_size: u64 = zig_h.len;
src/link/Coff.zig+10-10
......@@ -771,7 +771,7 @@ fn writeAtom(coff: *Coff, atom_index: Atom.Index, code: []u8, resolve_relocs: bo
771771 // if we are running in hot-code swapping mode or not.
772772 // TODO: how crazy would it be to try and apply the actual image base of the loaded
773773 // process for the in-file values rather than the Windows defaults?
774 var relocs = std.ArrayList(*Relocation).init(gpa);
774 var relocs = std.array_list.Managed(*Relocation).init(gpa);
775775 defer relocs.deinit();
776776
777777 if (resolve_relocs) {
......@@ -1680,7 +1680,7 @@ fn flushInner(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id) !void {
16801680 const section = coff.sections.get(@intFromEnum(sym.section_number) - 1).header;
16811681 const file_offset = section.pointer_to_raw_data + sym.value - section.virtual_address;
16821682
1683 var code = std.ArrayList(u8).init(gpa);
1683 var code = std.array_list.Managed(u8).init(gpa);
16841684 defer code.deinit();
16851685 try code.resize(math.cast(usize, atom.size) orelse return error.Overflow);
16861686 assert(atom.size > 0);
......@@ -1893,7 +1893,7 @@ pub fn updateLineNumber(coff: *Coff, pt: Zcu.PerThread, ti_id: InternPool.Tracke
18931893fn writeBaseRelocations(coff: *Coff) !void {
18941894 const gpa = coff.base.comp.gpa;
18951895
1896 var page_table = std.AutoHashMap(u32, std.ArrayList(coff_util.BaseRelocation)).init(gpa);
1896 var page_table = std.AutoHashMap(u32, std.array_list.Managed(coff_util.BaseRelocation)).init(gpa);
18971897 defer {
18981898 var it = page_table.valueIterator();
18991899 while (it.next()) |inner| {
......@@ -1915,7 +1915,7 @@ fn writeBaseRelocations(coff: *Coff) !void {
19151915 const page = mem.alignBackward(u32, rva, coff.page_size);
19161916 const gop = try page_table.getOrPut(page);
19171917 if (!gop.found_existing) {
1918 gop.value_ptr.* = std.ArrayList(coff_util.BaseRelocation).init(gpa);
1918 gop.value_ptr.* = std.array_list.Managed(coff_util.BaseRelocation).init(gpa);
19191919 }
19201920 try gop.value_ptr.append(.{
19211921 .offset = @as(u12, @intCast(rva - page)),
......@@ -1936,7 +1936,7 @@ fn writeBaseRelocations(coff: *Coff) !void {
19361936 const page = mem.alignBackward(u32, rva, coff.page_size);
19371937 const gop = try page_table.getOrPut(page);
19381938 if (!gop.found_existing) {
1939 gop.value_ptr.* = std.ArrayList(coff_util.BaseRelocation).init(gpa);
1939 gop.value_ptr.* = std.array_list.Managed(coff_util.BaseRelocation).init(gpa);
19401940 }
19411941 try gop.value_ptr.append(.{
19421942 .offset = @as(u12, @intCast(rva - page)),
......@@ -1947,7 +1947,7 @@ fn writeBaseRelocations(coff: *Coff) !void {
19471947 }
19481948
19491949 // Sort pages by address.
1950 var pages = try std.ArrayList(u32).initCapacity(gpa, page_table.count());
1950 var pages = try std.array_list.Managed(u32).initCapacity(gpa, page_table.count());
19511951 defer pages.deinit();
19521952 {
19531953 var it = page_table.keyIterator();
......@@ -1957,7 +1957,7 @@ fn writeBaseRelocations(coff: *Coff) !void {
19571957 }
19581958 mem.sort(u32, pages.items, {}, std.sort.asc(u32));
19591959
1960 var buffer = std.ArrayList(u8).init(gpa);
1960 var buffer = std.array_list.Managed(u8).init(gpa);
19611961 defer buffer.deinit();
19621962
19631963 for (pages.items) |page| {
......@@ -2030,7 +2030,7 @@ fn writeImportTables(coff: *Coff) !void {
20302030 try coff.growSection(coff.idata_section_index.?, needed_size);
20312031
20322032 // Do the actual writes
2033 var buffer = std.ArrayList(u8).init(gpa);
2033 var buffer = std.array_list.Managed(u8).init(gpa);
20342034 defer buffer.deinit();
20352035 try buffer.ensureTotalCapacityPrecise(needed_size);
20362036 buffer.resize(needed_size) catch unreachable;
......@@ -2153,7 +2153,7 @@ fn writeStrtab(coff: *Coff) !void {
21532153
21542154 log.debug("writing strtab from 0x{x} to 0x{x}", .{ coff.strtab_offset.?, coff.strtab_offset.? + needed_size });
21552155
2156 var buffer = std.ArrayList(u8).init(gpa);
2156 var buffer = std.array_list.Managed(u8).init(gpa);
21572157 defer buffer.deinit();
21582158 try buffer.ensureTotalCapacityPrecise(needed_size);
21592159 buffer.appendSliceAssumeCapacity(coff.strtab.buffer.items);
......@@ -2179,7 +2179,7 @@ fn writeDataDirectoriesHeaders(coff: *Coff) !void {
21792179fn writeHeader(coff: *Coff) !void {
21802180 const target = &coff.base.comp.root_mod.resolved_target.result;
21812181 const gpa = coff.base.comp.gpa;
2182 var buffer = std.ArrayList(u8).init(gpa);
2182 var buffer = std.array_list.Managed(u8).init(gpa);
21832183 defer buffer.deinit();
21842184 const writer = buffer.writer();
21852185
src/link/Elf.zig+17-17
......@@ -882,7 +882,7 @@ fn flushInner(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id) !void {
882882 self.rela_plt.clearRetainingCapacity();
883883
884884 if (self.zigObjectPtr()) |zo| {
885 var undefs: std.AutoArrayHashMap(SymbolResolver.Index, std.ArrayList(Ref)) = .init(gpa);
885 var undefs: std.AutoArrayHashMap(SymbolResolver.Index, std.array_list.Managed(Ref)) = .init(gpa);
886886 defer {
887887 for (undefs.values()) |*refs| refs.deinit();
888888 undefs.deinit();
......@@ -1326,7 +1326,7 @@ fn scanRelocs(self: *Elf) !void {
13261326 const gpa = self.base.comp.gpa;
13271327 const shared_objects = self.shared_objects.values();
13281328
1329 var undefs: std.AutoArrayHashMap(SymbolResolver.Index, std.ArrayList(Ref)) = .init(gpa);
1329 var undefs: std.AutoArrayHashMap(SymbolResolver.Index, std.array_list.Managed(Ref)) = .init(gpa);
13301330 defer {
13311331 for (undefs.values()) |*refs| refs.deinit();
13321332 undefs.deinit();
......@@ -1849,7 +1849,7 @@ pub fn updateMergeSectionSizes(self: *Elf) !void {
18491849
18501850pub fn writeMergeSections(self: *Elf) !void {
18511851 const gpa = self.base.comp.gpa;
1852 var buffer = std.ArrayList(u8).init(gpa);
1852 var buffer = std.array_list.Managed(u8).init(gpa);
18531853 defer buffer.deinit();
18541854
18551855 for (self.merge_sections.items) |*msec| {
......@@ -2214,7 +2214,7 @@ fn sortInitFini(self: *Elf) !void {
22142214 }
22152215 if (!is_init_fini and !is_ctor_dtor) continue;
22162216
2217 var entries = std.ArrayList(Entry).init(gpa);
2217 var entries = std.array_list.Managed(Entry).init(gpa);
22182218 try entries.ensureTotalCapacityPrecise(atom_list.atoms.keys().len);
22192219 defer entries.deinit();
22202220
......@@ -2771,7 +2771,7 @@ pub fn allocateAllocSections(self: *Elf) !void {
27712771 // virtual and file offsets. However, the simple one will do for one
27722772 // as we are more interested in quick turnaround and compatibility
27732773 // with `findFreeSpace` mechanics than anything else.
2774 const Cover = std.ArrayList(u32);
2774 const Cover = std.array_list.Managed(u32);
27752775 const gpa = self.base.comp.gpa;
27762776 var covers: [max_number_of_object_segments]Cover = undefined;
27772777 for (&covers) |*cover| {
......@@ -2999,13 +2999,13 @@ fn allocateSpecialPhdrs(self: *Elf) void {
29992999fn writeAtoms(self: *Elf) !void {
30003000 const gpa = self.base.comp.gpa;
30013001
3002 var undefs: std.AutoArrayHashMap(SymbolResolver.Index, std.ArrayList(Ref)) = .init(gpa);
3002 var undefs: std.AutoArrayHashMap(SymbolResolver.Index, std.array_list.Managed(Ref)) = .init(gpa);
30033003 defer {
30043004 for (undefs.values()) |*refs| refs.deinit();
30053005 undefs.deinit();
30063006 }
30073007
3008 var buffer = std.ArrayList(u8).init(gpa);
3008 var buffer = std.array_list.Managed(u8).init(gpa);
30093009 defer buffer.deinit();
30103010
30113011 const slice = self.sections.slice();
......@@ -3048,7 +3048,7 @@ pub fn updateSymtabSize(self: *Elf) !void {
30483048 const gpa = self.base.comp.gpa;
30493049 const shared_objects = self.shared_objects.values();
30503050
3051 var files = std.ArrayList(File.Index).init(gpa);
3051 var files = std.array_list.Managed(File.Index).init(gpa);
30523052 defer files.deinit();
30533053 try files.ensureTotalCapacityPrecise(self.objects.items.len + shared_objects.len + 2);
30543054
......@@ -3166,7 +3166,7 @@ fn writeSyntheticSections(self: *Elf) !void {
31663166
31673167 if (self.section_indexes.verneed) |shndx| {
31683168 const shdr = slice.items(.shdr)[shndx];
3169 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.verneed.size());
3169 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.verneed.size());
31703170 defer buffer.deinit();
31713171 try self.verneed.write(buffer.writer());
31723172 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3174,7 +3174,7 @@ fn writeSyntheticSections(self: *Elf) !void {
31743174
31753175 if (self.section_indexes.dynamic) |shndx| {
31763176 const shdr = slice.items(.shdr)[shndx];
3177 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.dynamic.size(self));
3177 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.dynamic.size(self));
31783178 defer buffer.deinit();
31793179 try self.dynamic.write(self, buffer.writer());
31803180 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3182,7 +3182,7 @@ fn writeSyntheticSections(self: *Elf) !void {
31823182
31833183 if (self.section_indexes.dynsymtab) |shndx| {
31843184 const shdr = slice.items(.shdr)[shndx];
3185 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.dynsym.size());
3185 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.dynsym.size());
31863186 defer buffer.deinit();
31873187 try self.dynsym.write(self, buffer.writer());
31883188 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3201,7 +3201,7 @@ fn writeSyntheticSections(self: *Elf) !void {
32013201 };
32023202 const shdr = slice.items(.shdr)[shndx];
32033203 const sh_size = try self.cast(usize, shdr.sh_size);
3204 var buffer = try std.ArrayList(u8).initCapacity(gpa, @intCast(sh_size - existing_size));
3204 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, @intCast(sh_size - existing_size));
32053205 defer buffer.deinit();
32063206 try eh_frame.writeEhFrame(self, buffer.writer());
32073207 assert(buffer.items.len == sh_size - existing_size);
......@@ -3211,7 +3211,7 @@ fn writeSyntheticSections(self: *Elf) !void {
32113211 if (self.section_indexes.eh_frame_hdr) |shndx| {
32123212 const shdr = slice.items(.shdr)[shndx];
32133213 const sh_size = try self.cast(usize, shdr.sh_size);
3214 var buffer = try std.ArrayList(u8).initCapacity(gpa, sh_size);
3214 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, sh_size);
32153215 defer buffer.deinit();
32163216 try eh_frame.writeEhFrameHdr(self, buffer.writer());
32173217 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3219,7 +3219,7 @@ fn writeSyntheticSections(self: *Elf) !void {
32193219
32203220 if (self.section_indexes.got) |index| {
32213221 const shdr = slice.items(.shdr)[index];
3222 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.got.size(self));
3222 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.got.size(self));
32233223 defer buffer.deinit();
32243224 try self.got.write(self, buffer.writer());
32253225 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3235,7 +3235,7 @@ fn writeSyntheticSections(self: *Elf) !void {
32353235
32363236 if (self.section_indexes.plt) |shndx| {
32373237 const shdr = slice.items(.shdr)[shndx];
3238 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.plt.size(self));
3238 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.plt.size(self));
32393239 defer buffer.deinit();
32403240 try self.plt.write(self, buffer.writer());
32413241 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3243,7 +3243,7 @@ fn writeSyntheticSections(self: *Elf) !void {
32433243
32443244 if (self.section_indexes.got_plt) |shndx| {
32453245 const shdr = slice.items(.shdr)[shndx];
3246 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.got_plt.size(self));
3246 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.got_plt.size(self));
32473247 defer buffer.deinit();
32483248 try self.got_plt.write(self, buffer.writer());
32493249 try self.pwriteAll(buffer.items, shdr.sh_offset);
......@@ -3251,7 +3251,7 @@ fn writeSyntheticSections(self: *Elf) !void {
32513251
32523252 if (self.section_indexes.plt_got) |shndx| {
32533253 const shdr = slice.items(.shdr)[shndx];
3254 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.plt_got.size(self));
3254 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.plt_got.size(self));
32553255 defer buffer.deinit();
32563256 try self.plt_got.write(self, buffer.writer());
32573257 try self.pwriteAll(buffer.items, shdr.sh_offset);
src/link/Elf/Atom.zig+2-2
......@@ -221,7 +221,7 @@ pub fn relocs(self: Atom, elf_file: *Elf) []const elf.Elf64_Rela {
221221 }
222222}
223223
224pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.ArrayList(elf.Elf64_Rela)) !void {
224pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.array_list.Managed(elf.Elf64_Rela)) !void {
225225 relocs_log.debug("0x{x}: {s}", .{ self.address(elf_file), self.name(elf_file) });
226226
227227 const cpu_arch = elf_file.getTarget().cpu.arch;
......@@ -607,7 +607,7 @@ fn reportUndefined(
607607 };
608608 const gop = try undefs.getOrPut(idx);
609609 if (!gop.found_existing) {
610 gop.value_ptr.* = std.ArrayList(Elf.Ref).init(gpa);
610 gop.value_ptr.* = std.array_list.Managed(Elf.Ref).init(gpa);
611611 }
612612 try gop.value_ptr.append(.{ .index = self.atom_index, .file = self.file_index });
613613 return true;
src/link/Elf/AtomList.zig+2-2
......@@ -89,7 +89,7 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {
8989 list.dirty = false;
9090}
9191
92pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_file: *Elf) !void {
92pub fn write(list: AtomList, buffer: *std.array_list.Managed(u8), undefs: anytype, elf_file: *Elf) !void {
9393 const gpa = elf_file.base.comp.gpa;
9494 const osec = elf_file.sections.items(.shdr)[list.output_section_index];
9595 assert(osec.sh_type != elf.SHT_NOBITS);
......@@ -126,7 +126,7 @@ pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_fi
126126 buffer.clearRetainingCapacity();
127127}
128128
129pub fn writeRelocatable(list: AtomList, buffer: *std.ArrayList(u8), elf_file: *Elf) !void {
129pub fn writeRelocatable(list: AtomList, buffer: *std.array_list.Managed(u8), elf_file: *Elf) !void {
130130 const gpa = elf_file.base.comp.gpa;
131131 const osec = elf_file.sections.items(.shdr)[list.output_section_index];
132132 assert(osec.sh_type != elf.SHT_NOBITS);
src/link/Elf/SharedObject.zig+1-1
......@@ -423,7 +423,7 @@ pub fn initSymbolAliases(self: *SharedObject, elf_file: *Elf) !void {
423423
424424 const comp = elf_file.base.comp;
425425 const gpa = comp.gpa;
426 var aliases = std.ArrayList(Symbol.Index).init(gpa);
426 var aliases = std.array_list.Managed(Symbol.Index).init(gpa);
427427 defer aliases.deinit();
428428 try aliases.ensureTotalCapacityPrecise(self.symbols.items.len);
429429
src/link/Elf/eh_frame.zig+3-3
......@@ -195,7 +195,7 @@ pub fn calcEhFrameSize(elf_file: *Elf) !usize {
195195 break :blk math.cast(usize, sym.atom(elf_file).?.size) orelse return error.Overflow;
196196 } else 0;
197197
198 var cies = std.ArrayList(Cie).init(gpa);
198 var cies = std.array_list.Managed(Cie).init(gpa);
199199 defer cies.deinit();
200200
201201 for (elf_file.objects.items) |index| {
......@@ -413,7 +413,7 @@ fn emitReloc(elf_file: *Elf, r_offset: u64, sym: *const Symbol, rel: elf.Elf64_R
413413 };
414414}
415415
416pub fn writeEhFrameRelocs(elf_file: *Elf, relocs: *std.ArrayList(elf.Elf64_Rela)) !void {
416pub fn writeEhFrameRelocs(elf_file: *Elf, relocs: *std.array_list.Managed(elf.Elf64_Rela)) !void {
417417 relocs_log.debug("{x}: .eh_frame", .{
418418 elf_file.sections.items(.shdr)[elf_file.section_indexes.eh_frame.?].sh_addr,
419419 });
......@@ -493,7 +493,7 @@ pub fn writeEhFrameHdr(elf_file: *Elf, writer: anytype) !void {
493493 }
494494 };
495495
496 var entries = std.ArrayList(Entry).init(gpa);
496 var entries = std.array_list.Managed(Entry).init(gpa);
497497 defer entries.deinit();
498498 try entries.ensureTotalCapacityPrecise(num_fdes);
499499
src/link/Elf/gc.zig+4-4
......@@ -1,14 +1,14 @@
11pub fn gcAtoms(elf_file: *Elf) !void {
22 const comp = elf_file.base.comp;
33 const gpa = comp.gpa;
4 var roots = std.ArrayList(*Atom).init(gpa);
4 var roots = std.array_list.Managed(*Atom).init(gpa);
55 defer roots.deinit();
66 try collectRoots(&roots, elf_file);
77 mark(roots, elf_file);
88 prune(elf_file);
99}
1010
11fn collectRoots(roots: *std.ArrayList(*Atom), elf_file: *Elf) !void {
11fn collectRoots(roots: *std.array_list.Managed(*Atom), elf_file: *Elf) !void {
1212 if (elf_file.linkerDefinedPtr()) |obj| {
1313 if (obj.entrySymbol(elf_file)) |sym| {
1414 try markSymbol(sym, roots, elf_file);
......@@ -82,7 +82,7 @@ fn collectRoots(roots: *std.ArrayList(*Atom), elf_file: *Elf) !void {
8282 }
8383}
8484
85fn markSymbol(sym: *Symbol, roots: *std.ArrayList(*Atom), elf_file: *Elf) !void {
85fn markSymbol(sym: *Symbol, roots: *std.array_list.Managed(*Atom), elf_file: *Elf) !void {
8686 if (sym.mergeSubsection(elf_file)) |msub| {
8787 msub.alive = true;
8888 return;
......@@ -133,7 +133,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void {
133133 }
134134}
135135
136fn mark(roots: std.ArrayList(*Atom), elf_file: *Elf) void {
136fn mark(roots: std.array_list.Managed(*Atom), elf_file: *Elf) void {
137137 for (roots.items) |root| {
138138 gc_track_live_log.debug("root atom({d})", .{root.atom_index});
139139 markLive(root, elf_file);
src/link/Elf/relocatable.zig+7-7
......@@ -44,7 +44,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void {
4444 try zig_object.readFileContents(elf_file);
4545 }
4646
47 var files = std.ArrayList(File.Index).init(gpa);
47 var files = std.array_list.Managed(File.Index).init(gpa);
4848 defer files.deinit();
4949 try files.ensureTotalCapacityPrecise(elf_file.objects.items.len + 1);
5050 if (elf_file.zigObjectPtr()) |zig_object| files.appendAssumeCapacity(zig_object.index);
......@@ -100,7 +100,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void {
100100 state_log.debug("ar_strtab\n{f}\n", .{ar_strtab});
101101 }
102102
103 var buffer = std.ArrayList(u8).init(gpa);
103 var buffer = std.array_list.Managed(u8).init(gpa);
104104 defer buffer.deinit();
105105 try buffer.ensureTotalCapacityPrecise(total_size);
106106
......@@ -347,7 +347,7 @@ fn allocateAllocSections(elf_file: *Elf) !void {
347347fn writeAtoms(elf_file: *Elf) !void {
348348 const gpa = elf_file.base.comp.gpa;
349349
350 var buffer = std.ArrayList(u8).init(gpa);
350 var buffer = std.array_list.Managed(u8).init(gpa);
351351 defer buffer.deinit();
352352
353353 const slice = elf_file.sections.slice();
......@@ -377,7 +377,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void {
377377
378378 const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse
379379 return error.Overflow;
380 var relocs = try std.ArrayList(elf.Elf64_Rela).initCapacity(gpa, num_relocs);
380 var relocs = try std.array_list.Managed(elf.Elf64_Rela).initCapacity(gpa, num_relocs);
381381 defer relocs.deinit();
382382
383383 for (atom_list.items) |ref| {
......@@ -407,7 +407,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void {
407407 };
408408 const shdr = slice.items(.shdr)[shndx];
409409 const sh_size = math.cast(usize, shdr.sh_size) orelse return error.Overflow;
410 var buffer = try std.ArrayList(u8).initCapacity(gpa, @intCast(sh_size - existing_size));
410 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, @intCast(sh_size - existing_size));
411411 defer buffer.deinit();
412412 try eh_frame.writeEhFrameRelocatable(elf_file, buffer.writer());
413413 log.debug("writing .eh_frame from 0x{x} to 0x{x}", .{
......@@ -421,7 +421,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void {
421421 const shdr = slice.items(.shdr)[shndx];
422422 const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse
423423 return error.Overflow;
424 var relocs = try std.ArrayList(elf.Elf64_Rela).initCapacity(gpa, num_relocs);
424 var relocs = try std.array_list.Managed(elf.Elf64_Rela).initCapacity(gpa, num_relocs);
425425 defer relocs.deinit();
426426 try eh_frame.writeEhFrameRelocs(elf_file, &relocs);
427427 assert(relocs.items.len == num_relocs);
......@@ -446,7 +446,7 @@ fn writeGroups(elf_file: *Elf) !void {
446446 for (elf_file.group_sections.items) |cgs| {
447447 const shdr = elf_file.sections.items(.shdr)[cgs.shndx];
448448 const sh_size = math.cast(usize, shdr.sh_size) orelse return error.Overflow;
449 var buffer = try std.ArrayList(u8).initCapacity(gpa, sh_size);
449 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, sh_size);
450450 defer buffer.deinit();
451451 try cgs.write(elf_file, buffer.writer());
452452 assert(buffer.items.len == sh_size);
src/link/Elf/synthetic_sections.zig+2-2
......@@ -18,7 +18,7 @@ pub const DynamicSection = struct {
1818 if (rpath_list.len == 0) return;
1919 const comp = elf_file.base.comp;
2020 const gpa = comp.gpa;
21 var rpath = std.ArrayList(u8).init(gpa);
21 var rpath = std.array_list.Managed(u8).init(gpa);
2222 defer rpath.deinit();
2323 for (rpath_list, 0..) |path, i| {
2424 if (i > 0) try rpath.append(':');
......@@ -1350,7 +1350,7 @@ pub const VerneedSection = struct {
13501350
13511351 const comp = elf_file.base.comp;
13521352 const gpa = comp.gpa;
1353 var verneed = std.ArrayList(VersionedSymbol).init(gpa);
1353 var verneed = std.array_list.Managed(VersionedSymbol).init(gpa);
13541354 defer verneed.deinit();
13551355 try verneed.ensureTotalCapacity(dynsyms.len);
13561356
src/link/Lld.zig+3-3
......@@ -409,7 +409,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {
409409 );
410410 } else {
411411 // Create an LLD command line and invoke it.
412 var argv = std.ArrayList([]const u8).init(gpa);
412 var argv = std.array_list.Managed([]const u8).init(gpa);
413413 defer argv.deinit();
414414 // We will invoke ourselves as a child process to gain access to LLD.
415415 // This is necessary because LLD does not behave properly as a library -
......@@ -863,7 +863,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
863863 );
864864 } else {
865865 // Create an LLD command line and invoke it.
866 var argv = std.ArrayList([]const u8).init(gpa);
866 var argv = std.array_list.Managed([]const u8).init(gpa);
867867 defer argv.deinit();
868868 // We will invoke ourselves as a child process to gain access to LLD.
869869 // This is necessary because LLD does not behave properly as a library -
......@@ -1412,7 +1412,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {
14121412 );
14131413 } else {
14141414 // Create an LLD command line and invoke it.
1415 var argv = std.ArrayList([]const u8).init(gpa);
1415 var argv = std.array_list.Managed([]const u8).init(gpa);
14161416 defer argv.deinit();
14171417 // We will invoke ourselves as a child process to gain access to LLD.
14181418 // This is necessary because LLD does not behave properly as a library -
src/link/MachO.zig+21-21
......@@ -359,7 +359,7 @@ pub fn flush(
359359 if (self.base.isStaticLib()) return relocatable.flushStaticLib(self, comp, zcu_obj_path);
360360 if (self.base.isObject()) return relocatable.flushObject(self, comp, zcu_obj_path);
361361
362 var positionals = std.ArrayList(link.Input).init(gpa);
362 var positionals = std.array_list.Managed(link.Input).init(gpa);
363363 defer positionals.deinit();
364364
365365 try positionals.ensureUnusedCapacity(comp.link_inputs.len);
......@@ -404,7 +404,7 @@ pub fn flush(
404404 diags.addParseError(link_input.path().?, "failed to read input file: {s}", .{@errorName(err)});
405405 }
406406
407 var system_libs = std.ArrayList(SystemLib).init(gpa);
407 var system_libs = std.array_list.Managed(SystemLib).init(gpa);
408408 defer system_libs.deinit();
409409
410410 // frameworks
......@@ -632,7 +632,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
632632 break :p try p.toString(arena);
633633 } else null;
634634
635 var argv = std.ArrayList([]const u8).init(arena);
635 var argv = std.array_list.Managed([]const u8).init(arena);
636636
637637 try argv.append("zig");
638638
......@@ -827,8 +827,8 @@ pub fn resolveLibSystem(
827827) !void {
828828 const diags = &self.base.comp.link_diags;
829829
830 var test_path = std.ArrayList(u8).init(arena);
831 var checked_paths = std.ArrayList([]const u8).init(arena);
830 var test_path = std.array_list.Managed(u8).init(arena);
831 var checked_paths = std.array_list.Managed([]const u8).init(arena);
832832
833833 success: {
834834 if (self.sdk_layout) |sdk_layout| switch (sdk_layout) {
......@@ -1065,8 +1065,8 @@ fn isHoisted(self: *MachO, install_name: []const u8) bool {
10651065/// TODO delete this, libraries must be instead resolved when instantiating the compilation pipeline
10661066fn accessLibPath(
10671067 arena: Allocator,
1068 test_path: *std.ArrayList(u8),
1069 checked_paths: *std.ArrayList([]const u8),
1068 test_path: *std.array_list.Managed(u8),
1069 checked_paths: *std.array_list.Managed([]const u8),
10701070 search_dir: []const u8,
10711071 name: []const u8,
10721072) !bool {
......@@ -1088,8 +1088,8 @@ fn accessLibPath(
10881088
10891089fn accessFrameworkPath(
10901090 arena: Allocator,
1091 test_path: *std.ArrayList(u8),
1092 checked_paths: *std.ArrayList([]const u8),
1091 test_path: *std.array_list.Managed(u8),
1092 checked_paths: *std.array_list.Managed([]const u8),
10931093 search_dir: []const u8,
10941094 name: []const u8,
10951095) !bool {
......@@ -1138,7 +1138,7 @@ fn parseDependentDylibs(self: *MachO) !void {
11381138 while (index < self.dylibs.items.len) : (index += 1) {
11391139 const dylib_index = self.dylibs.items[index];
11401140
1141 var dependents = std.ArrayList(File.Index).init(gpa);
1141 var dependents = std.array_list.Managed(File.Index).init(gpa);
11421142 defer dependents.deinit();
11431143 try dependents.ensureTotalCapacityPrecise(self.getFile(dylib_index).?.dylib.dependents.items.len);
11441144
......@@ -1151,8 +1151,8 @@ fn parseDependentDylibs(self: *MachO) !void {
11511151 // 3. If name is a relative path, substitute @rpath, @loader_path, @executable_path with
11521152 // dependees list of rpaths, and search there.
11531153 // 4. Finally, just search the provided relative path directly in CWD.
1154 var test_path = std.ArrayList(u8).init(arena);
1155 var checked_paths = std.ArrayList([]const u8).init(arena);
1154 var test_path = std.array_list.Managed(u8).init(arena);
1155 var checked_paths = std.array_list.Managed([]const u8).init(arena);
11561156
11571157 const full_path = full_path: {
11581158 {
......@@ -1550,7 +1550,7 @@ fn reportUndefs(self: *MachO) !void {
15501550 const max_notes = 4;
15511551
15521552 // We will sort by name, and then by file to ensure deterministic output.
1553 var keys = try std.ArrayList(SymbolResolver.Index).initCapacity(gpa, self.undefs.keys().len);
1553 var keys = try std.array_list.Managed(SymbolResolver.Index).initCapacity(gpa, self.undefs.keys().len);
15541554 defer keys.deinit();
15551555 keys.appendSliceAssumeCapacity(self.undefs.keys());
15561556 self.sortGlobalSymbolsByName(keys.items);
......@@ -1813,7 +1813,7 @@ pub fn sortSections(self: *MachO) !void {
18131813
18141814 const gpa = self.base.comp.gpa;
18151815
1816 var entries = try std.ArrayList(Entry).initCapacity(gpa, self.sections.slice().len);
1816 var entries = try std.array_list.Managed(Entry).initCapacity(gpa, self.sections.slice().len);
18171817 defer entries.deinit();
18181818 for (0..self.sections.slice().len) |index| {
18191819 entries.appendAssumeCapacity(.{ .index = @intCast(index) });
......@@ -2123,7 +2123,7 @@ fn initSegments(self: *MachO) !void {
21232123 }
21242124 };
21252125
2126 var entries = try std.ArrayList(Entry).initCapacity(gpa, self.segments.items.len);
2126 var entries = try std.array_list.Managed(Entry).initCapacity(gpa, self.segments.items.len);
21272127 defer entries.deinit();
21282128 for (0..self.segments.items.len) |index| {
21292129 entries.appendAssumeCapacity(.{ .index = @intCast(index) });
......@@ -2689,7 +2689,7 @@ pub fn writeDataInCode(self: *MachO) !void {
26892689 defer tracy.end();
26902690 const gpa = self.base.comp.gpa;
26912691 const cmd = self.data_in_code_cmd;
2692 var buffer = try std.ArrayList(u8).initCapacity(gpa, self.data_in_code.size());
2692 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, self.data_in_code.size());
26932693 defer buffer.deinit();
26942694 try self.data_in_code.write(self, buffer.writer());
26952695 try self.pwriteAll(buffer.items, cmd.dataoff);
......@@ -2701,7 +2701,7 @@ fn writeIndsymtab(self: *MachO) !void {
27012701 const gpa = self.base.comp.gpa;
27022702 const cmd = self.dysymtab_cmd;
27032703 const needed_size = cmd.nindirectsyms * @sizeOf(u32);
2704 var buffer = try std.ArrayList(u8).initCapacity(gpa, needed_size);
2704 var buffer = try std.array_list.Managed(u8).initCapacity(gpa, needed_size);
27052705 defer buffer.deinit();
27062706 try self.indsymtab.write(self, buffer.writer());
27072707 try self.pwriteAll(buffer.items, cmd.indirectsymoff);
......@@ -2746,7 +2746,7 @@ fn calcSymtabSize(self: *MachO) !void {
27462746
27472747 const gpa = self.base.comp.gpa;
27482748
2749 var files = std.ArrayList(File.Index).init(gpa);
2749 var files = std.array_list.Managed(File.Index).init(gpa);
27502750 defer files.deinit();
27512751 try files.ensureTotalCapacityPrecise(self.objects.items.len + self.dylibs.items.len + 2);
27522752 if (self.zig_object) |index| files.appendAssumeCapacity(index);
......@@ -3015,7 +3015,7 @@ pub fn writeCodeSignature(self: *MachO, code_sig: *CodeSignature) !void {
30153015 const seg = self.getTextSegment();
30163016 const offset = self.codesig_cmd.dataoff;
30173017
3018 var buffer = std.ArrayList(u8).init(self.base.comp.gpa);
3018 var buffer = std.array_list.Managed(u8).init(self.base.comp.gpa);
30193019 defer buffer.deinit();
30203020 try buffer.ensureTotalCapacityPrecise(code_sig.size());
30213021 try code_sig.writeAdhocSignature(self, .{
......@@ -3837,7 +3837,7 @@ fn reportDuplicates(self: *MachO) error{ HasDuplicates, OutOfMemory }!void {
38373837 const max_notes = 3;
38383838
38393839 // We will sort by name, and then by file to ensure deterministic output.
3840 var keys = try std.ArrayList(SymbolResolver.Index).initCapacity(gpa, self.dupes.keys().len);
3840 var keys = try std.array_list.Managed(SymbolResolver.Index).initCapacity(gpa, self.dupes.keys().len);
38413841 defer keys.deinit();
38423842 keys.appendSliceAssumeCapacity(self.dupes.keys());
38433843 self.sortGlobalSymbolsByName(keys.items);
......@@ -4269,7 +4269,7 @@ pub const Platform = struct {
42694269
42704270 /// Caller owns the memory.
42714271 pub fn allocPrintTarget(plat: Platform, gpa: Allocator, cpu_arch: std.Target.Cpu.Arch) error{OutOfMemory}![]u8 {
4272 var buffer = std.ArrayList(u8).init(gpa);
4272 var buffer = std.array_list.Managed(u8).init(gpa);
42734273 defer buffer.deinit();
42744274 try buffer.writer().print("{f}", .{plat.fmtTarget(cpu_arch)});
42754275 return buffer.toOwnedSlice();
src/link/MachO/CodeSignature.zig+3-3
......@@ -276,7 +276,7 @@ pub fn writeAdhocSignature(
276276 .count = 0,
277277 };
278278
279 var blobs = std.ArrayList(Blob).init(allocator);
279 var blobs = std.array_list.Managed(Blob).init(allocator);
280280 defer blobs.deinit();
281281
282282 self.code_directory.inner.execSegBase = opts.exec_seg_base;
......@@ -304,7 +304,7 @@ pub fn writeAdhocSignature(
304304 var hash: [hash_size]u8 = undefined;
305305
306306 if (self.requirements) |*req| {
307 var buf = std.ArrayList(u8).init(allocator);
307 var buf = std.array_list.Managed(u8).init(allocator);
308308 defer buf.deinit();
309309 try req.write(buf.writer());
310310 Sha256.hash(buf.items, &hash, .{});
......@@ -316,7 +316,7 @@ pub fn writeAdhocSignature(
316316 }
317317
318318 if (self.entitlements) |*ents| {
319 var buf = std.ArrayList(u8).init(allocator);
319 var buf = std.array_list.Managed(u8).init(allocator);
320320 defer buf.deinit();
321321 try ents.write(buf.writer());
322322 Sha256.hash(buf.items, &hash, .{});
src/link/MachO/Dylib.zig+1-1
......@@ -814,7 +814,7 @@ pub const TargetMatcher = struct {
814814
815815 const targets = switch (tbd) {
816816 .v3 => |v3| blk: {
817 var targets = std.ArrayList([]const u8).init(arena.allocator());
817 var targets = std.array_list.Managed([]const u8).init(arena.allocator());
818818 for (v3.archs) |arch| {
819819 if (mem.eql(u8, v3.platform, "zippered")) {
820820 // From Xcode 10.3 → 11.3.1, macos SDK .tbd files specify platform as 'zippered'
src/link/MachO/InternalObject.zig+1-1
......@@ -402,7 +402,7 @@ pub fn resolveLiterals(self: *InternalObject, lp: *MachO.LiteralPool, macho_file
402402
403403 const gpa = macho_file.base.comp.gpa;
404404
405 var buffer = std.ArrayList(u8).init(gpa);
405 var buffer = std.array_list.Managed(u8).init(gpa);
406406 defer buffer.deinit();
407407
408408 const slice = self.sections.slice();
src/link/MachO/Object.zig+2-2
......@@ -199,7 +199,7 @@ pub fn parse(self: *Object, macho_file: *MachO) !void {
199199 }
200200 };
201201
202 var nlists = try std.ArrayList(NlistIdx).initCapacity(gpa, self.symtab.items(.nlist).len);
202 var nlists = try std.array_list.Managed(NlistIdx).initCapacity(gpa, self.symtab.items(.nlist).len);
203203 defer nlists.deinit();
204204 for (self.symtab.items(.nlist), 0..) |nlist, i| {
205205 if (nlist.stab() or !nlist.sect()) continue;
......@@ -633,7 +633,7 @@ pub fn resolveLiterals(self: *Object, lp: *MachO.LiteralPool, macho_file: *MachO
633633 const gpa = macho_file.base.comp.gpa;
634634 const file = macho_file.getFileHandle(self.file_handle);
635635
636 var buffer = std.ArrayList(u8).init(gpa);
636 var buffer = std.array_list.Managed(u8).init(gpa);
637637 defer buffer.deinit();
638638
639639 var sections_data = std.AutoHashMap(u32, []const u8).init(gpa);
src/link/MachO/dead_strip.zig+4-4
......@@ -1,12 +1,12 @@
11pub fn gcAtoms(macho_file: *MachO) !void {
22 const gpa = macho_file.base.comp.gpa;
33
4 var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1);
4 var objects = try std.array_list.Managed(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1);
55 defer objects.deinit();
66 for (macho_file.objects.items) |index| objects.appendAssumeCapacity(index);
77 if (macho_file.internal_object) |index| objects.appendAssumeCapacity(index);
88
9 var roots = std.ArrayList(*Atom).init(gpa);
9 var roots = std.array_list.Managed(*Atom).init(gpa);
1010 defer roots.deinit();
1111
1212 try collectRoots(&roots, objects.items, macho_file);
......@@ -14,7 +14,7 @@ pub fn gcAtoms(macho_file: *MachO) !void {
1414 prune(objects.items, macho_file);
1515}
1616
17fn collectRoots(roots: *std.ArrayList(*Atom), objects: []const File.Index, macho_file: *MachO) !void {
17fn collectRoots(roots: *std.array_list.Managed(*Atom), objects: []const File.Index, macho_file: *MachO) !void {
1818 for (objects) |index| {
1919 const object = macho_file.getFile(index).?;
2020 for (object.getSymbols(), 0..) |*sym, i| {
......@@ -76,7 +76,7 @@ fn collectRoots(roots: *std.ArrayList(*Atom), objects: []const File.Index, macho
7676 }
7777}
7878
79fn markSymbol(sym: *Symbol, roots: *std.ArrayList(*Atom), macho_file: *MachO) !void {
79fn markSymbol(sym: *Symbol, roots: *std.array_list.Managed(*Atom), macho_file: *MachO) !void {
8080 const atom = sym.getAtom(macho_file) orelse return;
8181 if (markAtom(atom)) try roots.append(atom);
8282}
src/link/MachO/dyld_info/Rebase.zig+1-1
......@@ -25,7 +25,7 @@ pub fn updateSize(rebase: *Rebase, macho_file: *MachO) !void {
2525
2626 const gpa = macho_file.base.comp.gpa;
2727
28 var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2);
28 var objects = try std.array_list.Managed(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2);
2929 defer objects.deinit();
3030 objects.appendSliceAssumeCapacity(macho_file.objects.items);
3131 if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index);
src/link/MachO/dyld_info/Trie.zig+1-1
......@@ -134,7 +134,7 @@ fn finalize(self: *Trie, allocator: Allocator) !void {
134134 const tracy = trace(@src());
135135 defer tracy.end();
136136
137 var ordered_nodes = std.ArrayList(Node.Index).init(allocator);
137 var ordered_nodes = std.array_list.Managed(Node.Index).init(allocator);
138138 defer ordered_nodes.deinit();
139139 try ordered_nodes.ensureTotalCapacityPrecise(self.nodes.items(.is_terminal).len);
140140
src/link/MachO/dyld_info/bind.zig+2-2
......@@ -34,7 +34,7 @@ pub const Bind = struct {
3434 const gpa = macho_file.base.comp.gpa;
3535 const cpu_arch = macho_file.getTarget().cpu.arch;
3636
37 var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2);
37 var objects = try std.array_list.Managed(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2);
3838 defer objects.deinit();
3939 objects.appendSliceAssumeCapacity(macho_file.objects.items);
4040 if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index);
......@@ -286,7 +286,7 @@ pub const WeakBind = struct {
286286 const gpa = macho_file.base.comp.gpa;
287287 const cpu_arch = macho_file.getTarget().cpu.arch;
288288
289 var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2);
289 var objects = try std.array_list.Managed(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2);
290290 defer objects.deinit();
291291 objects.appendSliceAssumeCapacity(macho_file.objects.items);
292292 if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index);
src/link/MachO/eh_frame.zig+1-1
......@@ -275,7 +275,7 @@ pub fn calcSize(macho_file: *MachO) !u32 {
275275
276276 var offset: u32 = 0;
277277
278 var cies = std.ArrayList(Cie).init(macho_file.base.comp.gpa);
278 var cies = std.array_list.Managed(Cie).init(macho_file.base.comp.gpa);
279279 defer cies.deinit();
280280
281281 for (macho_file.objects.items) |index| {
src/link/MachO/relocatable.zig+5-5
......@@ -3,7 +3,7 @@ pub fn flushObject(macho_file: *MachO, comp: *Compilation, module_obj_path: ?Pat
33 const diags = &macho_file.base.comp.link_diags;
44
55 // TODO: "positional arguments" is a CLI concept, not a linker concept. Delete this unnecessary array list.
6 var positionals = std.ArrayList(link.Input).init(gpa);
6 var positionals = std.array_list.Managed(link.Input).init(gpa);
77 defer positionals.deinit();
88 try positionals.ensureUnusedCapacity(comp.link_inputs.len);
99 positionals.appendSliceAssumeCapacity(comp.link_inputs);
......@@ -81,7 +81,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ?
8181 const gpa = comp.gpa;
8282 const diags = &macho_file.base.comp.link_diags;
8383
84 var positionals = std.ArrayList(link.Input).init(gpa);
84 var positionals = std.array_list.Managed(link.Input).init(gpa);
8585 defer positionals.deinit();
8686
8787 try positionals.ensureUnusedCapacity(comp.link_inputs.len);
......@@ -143,7 +143,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ?
143143 try zo.readFileContents(macho_file);
144144 }
145145
146 var files = std.ArrayList(File.Index).init(gpa);
146 var files = std.array_list.Managed(File.Index).init(gpa);
147147 defer files.deinit();
148148 try files.ensureTotalCapacityPrecise(macho_file.objects.items.len + 1);
149149 if (macho_file.getZigObject()) |zo| files.appendAssumeCapacity(zo.index);
......@@ -205,7 +205,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ?
205205 state_log.debug("ar_symtab\n{f}\n", .{ar_symtab.fmt(macho_file)});
206206 }
207207
208 var buffer = std.ArrayList(u8).init(gpa);
208 var buffer = std.array_list.Managed(u8).init(gpa);
209209 defer buffer.deinit();
210210 try buffer.ensureTotalCapacityPrecise(total_size);
211211 const writer = buffer.writer();
......@@ -417,7 +417,7 @@ fn calcSymtabSize(macho_file: *MachO) error{OutOfMemory}!void {
417417 var nimports: u32 = 0;
418418 var strsize: u32 = 1;
419419
420 var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1);
420 var objects = try std.array_list.Managed(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1);
421421 defer objects.deinit();
422422 if (macho_file.getZigObject()) |zo| objects.appendAssumeCapacity(zo.index);
423423 objects.appendSliceAssumeCapacity(macho_file.objects.items);
src/link/SpirV/BinaryModule.zig+4-4
......@@ -280,7 +280,7 @@ pub const Parser = struct {
280280 self: *Parser,
281281 binary: BinaryModule,
282282 inst: Instruction,
283 offsets: *std.ArrayList(u16),
283 offsets: *std.array_list.Managed(u16),
284284 ) !void {
285285 const index = self.opcode_table.get(mapSetAndOpcode(.core, @intFromEnum(inst.opcode))).?;
286286 const operands = InstructionSet.core.instructions()[index].operands;
......@@ -333,7 +333,7 @@ pub const Parser = struct {
333333 inst: Instruction,
334334 operands: []const spec.Operand,
335335 start_offset: usize,
336 offsets: *std.ArrayList(u16),
336 offsets: *std.array_list.Managed(u16),
337337 ) !usize {
338338 var offset = start_offset;
339339 for (operands) |operand| {
......@@ -348,7 +348,7 @@ pub const Parser = struct {
348348 inst: Instruction,
349349 operand: spec.Operand,
350350 start_offset: usize,
351 offsets: *std.ArrayList(u16),
351 offsets: *std.array_list.Managed(u16),
352352 ) !usize {
353353 var offset = start_offset;
354354 switch (operand.quantifier) {
......@@ -371,7 +371,7 @@ pub const Parser = struct {
371371 inst: Instruction,
372372 kind: spec.OperandKind,
373373 start_offset: usize,
374 offsets: *std.ArrayList(u16),
374 offsets: *std.array_list.Managed(u16),
375375 ) !usize {
376376 var offset = start_offset;
377377 if (offset >= inst.operands.len) return error.InvalidPhysicalFormat;
src/link/SpirV/lower_invocation_globals.zig+4-4
......@@ -74,9 +74,9 @@ const ModuleInfo = struct {
7474 param_types: []const ResultId,
7575 }).init(arena);
7676 var calls = std.AutoArrayHashMap(ResultId, void).init(arena);
77 var callee_store = std.ArrayList(ResultId).init(arena);
77 var callee_store = std.array_list.Managed(ResultId).init(arena);
7878 var function_invocation_globals = std.AutoArrayHashMap(ResultId, void).init(arena);
79 var result_id_offsets = std.ArrayList(u16).init(arena);
79 var result_id_offsets = std.array_list.Managed(u16).init(arena);
8080 var invocation_globals = std.AutoArrayHashMap(ResultId, InvocationGlobal).init(arena);
8181
8282 var maybe_current_function: ?ResultId = null;
......@@ -498,8 +498,8 @@ const ModuleBuilder = struct {
498498 binary: BinaryModule,
499499 info: ModuleInfo,
500500 ) !void {
501 var result_id_offsets = std.ArrayList(u16).init(self.arena);
502 var operands = std.ArrayList(u32).init(self.arena);
501 var result_id_offsets = std.array_list.Managed(u16).init(self.arena);
502 var operands = std.array_list.Managed(u32).init(self.arena);
503503
504504 var maybe_current_function: ?ResultId = null;
505505 var it = binary.iterateInstructionsFrom(binary.sections.functions);
src/link/Wasm/Flush.zig+2-2
......@@ -1051,7 +1051,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
10511051 },
10521052 }
10531053
1054 var debug_bytes = std.ArrayList(u8).init(gpa);
1054 var debug_bytes = std.array_list.Managed(u8).init(gpa);
10551055 defer debug_bytes.deinit();
10561056
10571057 try emitProducerSection(gpa, binary_bytes);
......@@ -1396,7 +1396,7 @@ pub fn emitExpr(wasm: *const Wasm, binary_bytes: *std.ArrayListUnmanaged(u8), ex
13961396 try binary_bytes.appendSlice(gpa, slice[0 .. slice.len + 1]); // +1 to include end opcode
13971397}
13981398
1399fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.ArrayList(u8)) !void {
1399fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.array_list.Managed(u8)) !void {
14001400 const gpa = wasm.base.comp.gpa;
14011401 const writer = binary_bytes.writer(gpa);
14021402 try leb.writeUleb128(writer, @intFromEnum(Wasm.SubsectionType.segment_info));
src/link/tapi.zig+1-1
......@@ -83,7 +83,7 @@ pub const Tbd = union(enum) {
8383
8484 /// Caller owns memory.
8585 pub fn targets(self: Tbd, gpa: Allocator) error{OutOfMemory}![]const []const u8 {
86 var out = std.ArrayList([]const u8).init(gpa);
86 var out = std.array_list.Managed([]const u8).init(gpa);
8787 defer out.deinit();
8888
8989 switch (self) {
src/link/tapi/Tokenizer.zig+1-1
......@@ -297,7 +297,7 @@ fn testExpected(source: []const u8, expected: []const Token.Id) !void {
297297 .buffer = source,
298298 };
299299
300 var given = std.ArrayList(Token.Id).init(testing.allocator);
300 var given = std.array_list.Managed(Token.Id).init(testing.allocator);
301301 defer given.deinit();
302302
303303 while (true) {
src/link/tapi/parse.zig+1-1
......@@ -231,7 +231,7 @@ pub const Tree = struct {
231231
232232 pub fn parse(self: *Tree, source: []const u8) !void {
233233 var tokenizer = Tokenizer{ .buffer = source };
234 var tokens = std.ArrayList(Token).init(self.allocator);
234 var tokens = std.array_list.Managed(Token).init(self.allocator);
235235 defer tokens.deinit();
236236
237237 var line: usize = 0;
src/link/tapi/yaml.zig+5-5
......@@ -172,7 +172,7 @@ pub const Value = union(enum) {
172172
173173 return Value{ .map = out_map };
174174 } else if (node.cast(Node.List)) |list| {
175 var out_list = std.ArrayList(Value).init(arena);
175 var out_list = std.array_list.Managed(Value).init(arena);
176176 try out_list.ensureUnusedCapacity(list.values.items.len);
177177
178178 for (list.values.items) |elem| {
......@@ -211,7 +211,7 @@ pub const Value = union(enum) {
211211 .float => return Value{ .float = math.lossyCast(f64, input) },
212212
213213 .@"struct" => |info| if (info.is_tuple) {
214 var list = std.ArrayList(Value).init(arena);
214 var list = std.array_list.Managed(Value).init(arena);
215215 errdefer list.deinit();
216216 try list.ensureTotalCapacityPrecise(info.fields.len);
217217
......@@ -262,7 +262,7 @@ pub const Value = union(enum) {
262262 return Value{ .string = try arena.dupe(u8, input) };
263263 }
264264
265 var list = std.ArrayList(Value).init(arena);
265 var list = std.array_list.Managed(Value).init(arena);
266266 errdefer list.deinit();
267267 try list.ensureTotalCapacityPrecise(input.len);
268268
......@@ -298,7 +298,7 @@ pub const Value = union(enum) {
298298pub const Yaml = struct {
299299 arena: ArenaAllocator,
300300 tree: ?Tree = null,
301 docs: std.ArrayList(Value),
301 docs: std.array_list.Managed(Value),
302302
303303 pub fn deinit(self: *Yaml) void {
304304 self.arena.deinit();
......@@ -311,7 +311,7 @@ pub const Yaml = struct {
311311 var tree = Tree.init(arena.allocator());
312312 try tree.parse(source);
313313
314 var docs = std.ArrayList(Value).init(arena.allocator());
314 var docs = std.array_list.Managed(Value).init(arena.allocator());
315315 try docs.ensureTotalCapacityPrecise(tree.docs.items.len);
316316
317317 for (tree.docs.items) |node| {
src/link/tapi/yaml/test.zig+1-1
......@@ -407,7 +407,7 @@ test "duplicate map keys" {
407407}
408408
409409fn testStringify(expected: []const u8, input: anytype) !void {
410 var output = std.ArrayList(u8).init(testing.allocator);
410 var output = std.array_list.Managed(u8).init(testing.allocator);
411411 defer output.deinit();
412412
413413 try yaml_mod.stringify(testing.allocator, input, output.writer());
src/main.zig+18-19
......@@ -6,7 +6,6 @@ const fs = std.fs;
66const mem = std.mem;
77const process = std.process;
88const Allocator = mem.Allocator;
9const ArrayList = std.ArrayList;
109const Ast = std.zig.Ast;
1110const Color = std.zig.Color;
1211const warn = std.log.warn;
......@@ -1876,8 +1875,8 @@ fn buildOutputType(
18761875 var c_out_mode: ?COutMode = null;
18771876 var out_path: ?[]const u8 = null;
18781877 var is_shared_lib = false;
1879 var preprocessor_args = std.ArrayList([]const u8).init(arena);
1880 var linker_args = std.ArrayList([]const u8).init(arena);
1878 var preprocessor_args = std.array_list.Managed([]const u8).init(arena);
1879 var linker_args = std.array_list.Managed([]const u8).init(arena);
18811880 var it = ClangArgIterator.init(arena, all_args);
18821881 var emit_llvm = false;
18831882 var needed = false;
......@@ -3136,16 +3135,16 @@ fn buildOutputType(
31363135 }
31373136 }
31383137
3139 var resolved_frameworks = std.ArrayList(Compilation.Framework).init(arena);
3138 var resolved_frameworks = std.array_list.Managed(Compilation.Framework).init(arena);
31403139
31413140 if (create_module.frameworks.keys().len > 0) {
3142 var test_path = std.ArrayList(u8).init(gpa);
3141 var test_path = std.array_list.Managed(u8).init(gpa);
31433142 defer test_path.deinit();
31443143
3145 var checked_paths = std.ArrayList(u8).init(gpa);
3144 var checked_paths = std.array_list.Managed(u8).init(gpa);
31463145 defer checked_paths.deinit();
31473146
3148 var failed_frameworks = std.ArrayList(struct {
3147 var failed_frameworks = std.array_list.Managed(struct {
31493148 name: []const u8,
31503149 checked_paths: []const u8,
31513150 }).init(arena);
......@@ -3774,7 +3773,7 @@ fn createModule(
37743773 try llvm_to_zig_name.put(llvm_name, feature.name);
37753774 }
37763775
3777 var mcpu_buffer = std.ArrayList(u8).init(gpa);
3776 var mcpu_buffer = std.array_list.Managed(u8).init(gpa);
37783777 defer mcpu_buffer.deinit();
37793778
37803779 try mcpu_buffer.appendSlice(cli_mod.target_mcpu orelse "baseline");
......@@ -4332,7 +4331,7 @@ fn runOrTest(
43324331 }),
43334332 };
43344333
4335 var argv = std.ArrayList([]const u8).init(gpa);
4334 var argv = std.array_list.Managed([]const u8).init(gpa);
43364335 defer argv.deinit();
43374336
43384337 if (test_exec_args.len == 0) {
......@@ -4453,7 +4452,7 @@ fn runOrTestHotSwap(
44534452 };
44544453 defer gpa.free(exe_path);
44554454
4456 var argv = std.ArrayList([]const u8).init(gpa);
4455 var argv = std.array_list.Managed([]const u8).init(gpa);
44574456 defer argv.deinit();
44584457
44594458 if (test_exec_args.len == 0) {
......@@ -4570,7 +4569,7 @@ fn cmdTranslateC(
45704569 break :digest .{ bin_digest, hex_digest };
45714570 } else digest: {
45724571 if (fancy_output) |p| p.cache_hit = false;
4573 var argv = std.ArrayList([]const u8).init(arena);
4572 var argv = std.array_list.Managed([]const u8).init(arena);
45744573 switch (comp.config.c_frontend) {
45754574 .aro => {},
45764575 .clang => {
......@@ -4877,7 +4876,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
48774876 var override_global_cache_dir: ?[]const u8 = try EnvVar.ZIG_GLOBAL_CACHE_DIR.get(arena);
48784877 var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena);
48794878 var override_build_runner: ?[]const u8 = try EnvVar.ZIG_BUILD_RUNNER.get(arena);
4880 var child_argv = std.ArrayList([]const u8).init(arena);
4879 var child_argv = std.array_list.Managed([]const u8).init(arena);
48814880 var reference_trace: ?u32 = null;
48824881 var debug_compile_errors = false;
48834882 var verbose_link = (native_os != .wasi or builtin.link_libc) and
......@@ -5304,7 +5303,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
53045303
53055304 if (fetch_only) return cleanExit();
53065305
5307 var source_buf = std.ArrayList(u8).init(gpa);
5306 var source_buf = std.array_list.Managed(u8).init(gpa);
53085307 defer source_buf.deinit();
53095308 try job_queue.createDependenciesSource(&source_buf);
53105309 const deps_mod = try createDependenciesModule(
......@@ -5986,7 +5985,7 @@ pub const ClangArgIterator = struct {
59865985 // NOTE: The ArgIteratorResponseFile returns tokens from next() that are slices of an
59875986 // internal buffer. This internal buffer is arena allocated, so it is not cleaned up here.
59885987
5989 var resp_arg_list = std.ArrayList([]const u8).init(arena);
5988 var resp_arg_list = std.array_list.Managed([]const u8).init(arena);
59905989 defer resp_arg_list.deinit();
59915990 {
59925991 while (self.arg_iterator_response_file.next()) |token| {
......@@ -6868,8 +6867,8 @@ const ClangSearchSanitizer = struct {
68686867};
68696868
68706869fn accessFrameworkPath(
6871 test_path: *std.ArrayList(u8),
6872 checked_paths: *std.ArrayList(u8),
6870 test_path: *std.array_list.Managed(u8),
6871 checked_paths: *std.array_list.Managed(u8),
68736872 framework_dir_path: []const u8,
68746873 framework_name: []const u8,
68756874) !bool {
......@@ -7214,7 +7213,7 @@ fn createEmptyDependenciesModule(
72147213 dirs: Compilation.Directories,
72157214 global_options: Compilation.Config,
72167215) !void {
7217 var source = std.ArrayList(u8).init(arena);
7216 var source = std.array_list.Managed(u8).init(arena);
72187217 try Package.Fetch.JobQueue.createEmptyDependenciesSource(&source);
72197218 _ = try createDependenciesModule(
72207219 arena,
......@@ -7418,7 +7417,7 @@ fn loadManifest(
74187417const Templates = struct {
74197418 zig_lib_directory: Cache.Directory,
74207419 dir: fs.Dir,
7421 buffer: std.ArrayList(u8),
7420 buffer: std.array_list.Managed(u8),
74227421
74237422 fn deinit(templates: *Templates) void {
74247423 templates.zig_lib_directory.handle.close();
......@@ -7510,7 +7509,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator) Templates {
75107509 return .{
75117510 .zig_lib_directory = zig_lib_directory,
75127511 .dir = template_dir,
7513 .buffer = std.ArrayList(u8).init(gpa),
7512 .buffer = std.array_list.Managed(u8).init(gpa),
75147513 };
75157514}
75167515
src/translate_c.zig+13-13
......@@ -924,10 +924,10 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD
924924 break :blk Tag.opaque_literal.init();
925925 };
926926
927 var fields = std.ArrayList(ast.Payload.Record.Field).init(c.gpa);
927 var fields = std.array_list.Managed(ast.Payload.Record.Field).init(c.gpa);
928928 defer fields.deinit();
929929
930 var functions = std.ArrayList(Node).init(c.gpa);
930 var functions = std.array_list.Managed(Node).init(c.gpa);
931931 defer functions.deinit();
932932
933933 const flexible_field = flexibleArrayField(c, record_def);
......@@ -2606,7 +2606,7 @@ fn transInitListExprRecord(
26062606
26072607 const ty_node = try transType(c, scope, ty, loc);
26082608 const init_count = expr.getNumInits();
2609 var field_inits = std.ArrayList(ast.Payload.ContainerInit.Initializer).init(c.gpa);
2609 var field_inits = std.array_list.Managed(ast.Payload.ContainerInit.Initializer).init(c.gpa);
26102610 defer field_inits.deinit();
26112611
26122612 if (init_count == 0) {
......@@ -3116,7 +3116,7 @@ fn transSwitch(
31163116 defer cond_scope.deinit();
31173117 const switch_expr = try transExpr(c, &cond_scope.base, stmt.getCond(), .used);
31183118
3119 var cases = std.ArrayList(Node).init(c.gpa);
3119 var cases = std.array_list.Managed(Node).init(c.gpa);
31203120 defer cases.deinit();
31213121 var has_default = false;
31223122
......@@ -3130,7 +3130,7 @@ fn transSwitch(
31303130 while (it != end_it) : (it += 1) {
31313131 switch (it[0].getStmtClass()) {
31323132 .CaseStmtClass => {
3133 var items = std.ArrayList(Node).init(c.gpa);
3133 var items = std.array_list.Managed(Node).init(c.gpa);
31343134 defer items.deinit();
31353135 const sub = try transCaseStmt(c, base_scope, it[0], &items);
31363136 const res = try transSwitchProngStmt(c, base_scope, sub, it, end_it);
......@@ -3185,7 +3185,7 @@ fn transSwitch(
31853185
31863186/// Collects all items for this case, returns the first statement after the labels.
31873187/// If items ends up empty, the prong should be translated as an else.
3188fn transCaseStmt(c: *Context, scope: *Scope, stmt: *const clang.Stmt, items: *std.ArrayList(Node)) TransError!*const clang.Stmt {
3188fn transCaseStmt(c: *Context, scope: *Scope, stmt: *const clang.Stmt, items: *std.array_list.Managed(Node)) TransError!*const clang.Stmt {
31893189 var sub = stmt;
31903190 var seen_default = false;
31913191 while (true) {
......@@ -4716,7 +4716,7 @@ fn transCreateNodeNumber(c: *Context, num: anytype, num_kind: enum { int, float
47164716}
47174717
47184718fn transCreateNodeMacroFn(c: *Context, name: []const u8, ref: Node, proto_alias: *ast.Payload.Func) !Node {
4719 var fn_params = std.ArrayList(ast.Payload.Param).init(c.gpa);
4719 var fn_params = std.array_list.Managed(ast.Payload.Param).init(c.gpa);
47204720 defer fn_params.deinit();
47214721
47224722 for (proto_alias.data.params) |param| {
......@@ -5115,7 +5115,7 @@ fn finishTransFnProto(
51155115 const scope = &c.global_scope.base;
51165116
51175117 const param_count: usize = if (fn_proto_ty != null) fn_proto_ty.?.getNumParams() else 0;
5118 var fn_params = try std.ArrayList(ast.Payload.Param).initCapacity(c.gpa, param_count);
5118 var fn_params = try std.array_list.Managed(ast.Payload.Param).initCapacity(c.gpa, param_count);
51195119 defer fn_params.deinit();
51205120
51215121 var i: usize = 0;
......@@ -5333,7 +5333,7 @@ fn transPreprocessorEntities(c: *Context, unit: *clang.ASTUnit) Error!void {
53335333 // TODO if we see #undef, delete it from the table
53345334 var it = unit.getLocalPreprocessingEntities_begin();
53355335 const it_end = unit.getLocalPreprocessingEntities_end();
5336 var tok_list = std.ArrayList(CToken).init(c.gpa);
5336 var tok_list = std.array_list.Managed(CToken).init(c.gpa);
53375337 defer tok_list.deinit();
53385338 const scope = c.global_scope;
53395339
......@@ -5484,7 +5484,7 @@ fn transMacroFnDefine(c: *Context, m: *MacroCtx) ParseError!void {
54845484
54855485 try m.skip(c, .l_paren);
54865486
5487 var fn_params = std.ArrayList(ast.Payload.Param).init(c.gpa);
5487 var fn_params = std.array_list.Managed(ast.Payload.Param).init(c.gpa);
54885488 defer fn_params.deinit();
54895489
54905490 while (true) {
......@@ -6459,7 +6459,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ?
64596459 m.i += 1;
64606460 node = try Tag.call.create(c.arena, .{ .lhs = node, .args = &[0]Node{} });
64616461 } else {
6462 var args = std.ArrayList(Node).init(c.gpa);
6462 var args = std.array_list.Managed(Node).init(c.gpa);
64636463 defer args.deinit();
64646464 while (true) {
64656465 const arg = try parseCCondExpr(c, m, scope);
......@@ -6480,7 +6480,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ?
64806480 .l_brace => {
64816481 // Check for designated field initializers
64826482 if (m.peek().? == .period) {
6483 var init_vals = std.ArrayList(ast.Payload.ContainerInitDot.Initializer).init(c.gpa);
6483 var init_vals = std.array_list.Managed(ast.Payload.ContainerInitDot.Initializer).init(c.gpa);
64846484 defer init_vals.deinit();
64856485
64866486 while (true) {
......@@ -6506,7 +6506,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ?
65066506 continue;
65076507 }
65086508
6509 var init_vals = std.ArrayList(Node).init(c.gpa);
6509 var init_vals = std.array_list.Managed(Node).init(c.gpa);
65106510 defer init_vals.deinit();
65116511
65126512 while (true) {
test/behavior/struct.zig+1-1
......@@ -1826,7 +1826,7 @@ test "assign to slice.len of global variable" {
18261826
18271827 const S = struct {
18281828 const allocator = std.testing.allocator;
1829 var list = std.ArrayList(u32).init(allocator);
1829 var list = std.array_list.Managed(u32).init(allocator);
18301830 };
18311831
18321832 S.list.items.len = 0;
test/behavior/var_args.zig+3-3
......@@ -200,14 +200,14 @@ test "variadic functions" {
200200 if (builtin.cpu.arch.isSPARC() and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23718
201201
202202 const S = struct {
203 fn printf(list_ptr: *std.ArrayList(u8), format: [*:0]const u8, ...) callconv(.c) void {
203 fn printf(list_ptr: *std.array_list.Managed(u8), format: [*:0]const u8, ...) callconv(.c) void {
204204 var ap = @cVaStart();
205205 defer @cVaEnd(&ap);
206206 vprintf(list_ptr, format, &ap);
207207 }
208208
209209 fn vprintf(
210 list: *std.ArrayList(u8),
210 list: *std.array_list.Managed(u8),
211211 format: [*:0]const u8,
212212 ap: *std.builtin.VaList,
213213 ) callconv(.c) void {
......@@ -225,7 +225,7 @@ test "variadic functions" {
225225 }
226226 };
227227
228 var list = std.ArrayList(u8).init(std.testing.allocator);
228 var list = std.array_list.Managed(u8).init(std.testing.allocator);
229229 defer list.deinit();
230230 S.printf(&list, "dsd", @as(c_int, 1), @as([*:0]const u8, "hello"), @as(c_int, 5));
231231 try std.testing.expectEqualStrings("1hello5", list.items);
test/src/Cases.zig+28-27
......@@ -1,7 +1,15 @@
1const Cases = @This();
2const builtin = @import("builtin");
3const std = @import("std");
4const assert = std.debug.assert;
5const Allocator = std.mem.Allocator;
6const getExternalExecutor = std.zig.system.getExternalExecutor;
7const ArrayList = std.ArrayList;
8
19gpa: Allocator,
210arena: Allocator,
3cases: std.ArrayList(Case),
4translate: std.ArrayList(Translate),
11cases: std.array_list.Managed(Case),
12translate: std.array_list.Managed(Translate),
513
614pub const IncrementalCase = struct {
715 base_path: []const u8,
......@@ -40,7 +48,7 @@ pub const Case = struct {
4048 output_mode: std.builtin.OutputMode,
4149 optimize_mode: std.builtin.OptimizeMode = .Debug,
4250
43 files: std.ArrayList(File),
51 files: std.array_list.Managed(File),
4452 case: ?union(enum) {
4553 /// Check that it compiles with no errors.
4654 Compile: void,
......@@ -77,7 +85,7 @@ pub const Case = struct {
7785 /// `lower_to_build_steps`. If null, file imports will assert.
7886 import_path: ?[]const u8 = null,
7987
80 deps: std.ArrayList(DepModule),
88 deps: std.array_list.Managed(DepModule),
8189
8290 pub fn addSourceFile(case: *Case, name: []const u8, src: [:0]const u8) void {
8391 case.files.append(.{ .path = name, .src = src }) catch @panic("OOM");
......@@ -148,7 +156,7 @@ pub fn addExe(
148156 .files = .init(ctx.arena),
149157 .case = null,
150158 .output_mode = .Exe,
151 .deps = std.ArrayList(DepModule).init(ctx.arena),
159 .deps = std.array_list.Managed(DepModule).init(ctx.arena),
152160 }) catch @panic("out of memory");
153161 return &ctx.cases.items[ctx.cases.items.len - 1];
154162}
......@@ -167,7 +175,7 @@ pub fn exeFromCompiledC(ctx: *Cases, name: []const u8, target_query: std.Target.
167175 .files = .init(ctx.arena),
168176 .case = null,
169177 .output_mode = .Exe,
170 .deps = std.ArrayList(DepModule).init(ctx.arena),
178 .deps = std.array_list.Managed(DepModule).init(ctx.arena),
171179 .link_libc = true,
172180 }) catch @panic("out of memory");
173181 return &ctx.cases.items[ctx.cases.items.len - 1];
......@@ -197,7 +205,7 @@ pub fn addObjLlvm(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarge
197205 .files = .init(ctx.arena),
198206 .case = null,
199207 .output_mode = .Obj,
200 .deps = std.ArrayList(DepModule).init(ctx.arena),
208 .deps = std.array_list.Managed(DepModule).init(ctx.arena),
201209 .backend = .llvm,
202210 .emit_bin = can_emit_bin,
203211 .emit_asm = can_emit_asm,
......@@ -216,7 +224,7 @@ pub fn addObj(
216224 .files = .init(ctx.arena),
217225 .case = null,
218226 .output_mode = .Obj,
219 .deps = std.ArrayList(DepModule).init(ctx.arena),
227 .deps = std.array_list.Managed(DepModule).init(ctx.arena),
220228 }) catch @panic("out of memory");
221229 return &ctx.cases.items[ctx.cases.items.len - 1];
222230}
......@@ -233,7 +241,7 @@ pub fn addTest(
233241 .case = null,
234242 .output_mode = .Exe,
235243 .is_test = true,
236 .deps = std.ArrayList(DepModule).init(ctx.arena),
244 .deps = std.array_list.Managed(DepModule).init(ctx.arena),
237245 }) catch @panic("out of memory");
238246 return &ctx.cases.items[ctx.cases.items.len - 1];
239247}
......@@ -258,7 +266,7 @@ pub fn addC(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarget) *Ca
258266 .files = .init(ctx.arena),
259267 .case = null,
260268 .output_mode = .Obj,
261 .deps = std.ArrayList(DepModule).init(ctx.arena),
269 .deps = std.array_list.Managed(DepModule).init(ctx.arena),
262270 }) catch @panic("out of memory");
263271 return &ctx.cases.items[ctx.cases.items.len - 1];
264272}
......@@ -364,7 +372,7 @@ fn addFromDirInner(
364372 b: *std.Build,
365373) !void {
366374 var it = try iterable_dir.walk(ctx.arena);
367 var filenames: std.ArrayListUnmanaged([]const u8) = .empty;
375 var filenames: ArrayList([]const u8) = .empty;
368376
369377 while (try it.next()) |entry| {
370378 if (entry.kind != .file) continue;
......@@ -428,7 +436,7 @@ fn addFromDirInner(
428436 continue;
429437 }
430438
431 var cases = std.ArrayList(usize).init(ctx.arena);
439 var cases = std.array_list.Managed(usize).init(ctx.arena);
432440
433441 // Cross-product to get all possible test combinations
434442 for (targets) |target_query| {
......@@ -462,7 +470,7 @@ fn addFromDirInner(
462470 .link_libc = link_libc,
463471 .pic = pic,
464472 .pie = pie,
465 .deps = std.ArrayList(DepModule).init(ctx.cases.allocator),
473 .deps = std.array_list.Managed(DepModule).init(ctx.cases.allocator),
466474 .imports = imports,
467475 .target = resolved_target,
468476 });
......@@ -495,8 +503,8 @@ fn addFromDirInner(
495503pub fn init(gpa: Allocator, arena: Allocator) Cases {
496504 return .{
497505 .gpa = gpa,
498 .cases = std.ArrayList(Case).init(gpa),
499 .translate = std.ArrayList(Translate).init(gpa),
506 .cases = std.array_list.Managed(Case).init(gpa),
507 .translate = std.array_list.Managed(Translate).init(gpa),
500508 .arena = arena,
501509 };
502510}
......@@ -995,7 +1003,7 @@ const TestManifest = struct {
9951003 key: []const u8,
9961004 comptime T: type,
9971005 ) ![]const T {
998 var out = std.ArrayList(T).init(allocator);
1006 var out = std.array_list.Managed(T).init(allocator);
9991007 defer out.deinit();
10001008 var it = self.getConfigForKey(key, T);
10011009 while (try it.next()) |item| {
......@@ -1018,7 +1026,7 @@ const TestManifest = struct {
10181026 }
10191027
10201028 fn trailingSplit(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const u8 {
1021 var out = std.ArrayList(u8).init(allocator);
1029 var out = std.array_list.Managed(u8).init(allocator);
10221030 defer out.deinit();
10231031 var trailing_it = self.trailing();
10241032 while (trailing_it.next()) |line| {
......@@ -1032,7 +1040,7 @@ const TestManifest = struct {
10321040 }
10331041
10341042 fn trailingLines(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const []const u8 {
1035 var out = std.ArrayList([]const u8).init(allocator);
1043 var out = std.array_list.Managed([]const u8).init(allocator);
10361044 defer out.deinit();
10371045 var it = self.trailing();
10381046 while (it.next()) |line| {
......@@ -1043,9 +1051,9 @@ const TestManifest = struct {
10431051
10441052 fn trailingLinesSplit(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const []const u8 {
10451053 // Collect output lines split by empty lines
1046 var out = std.ArrayList([]const u8).init(allocator);
1054 var out = std.array_list.Managed([]const u8).init(allocator);
10471055 defer out.deinit();
1048 var buf = std.ArrayList(u8).init(allocator);
1056 var buf = std.array_list.Managed(u8).init(allocator);
10491057 defer buf.deinit();
10501058 var it = self.trailing();
10511059 while (it.next()) |line| {
......@@ -1119,13 +1127,6 @@ const TestManifest = struct {
11191127 }
11201128};
11211129
1122const Cases = @This();
1123const builtin = @import("builtin");
1124const std = @import("std");
1125const assert = std.debug.assert;
1126const Allocator = std.mem.Allocator;
1127const getExternalExecutor = std.zig.system.getExternalExecutor;
1128
11291130fn resolveTargetQuery(query: std.Target.Query) std.Build.ResolvedTarget {
11301131 return .{
11311132 .query = query,
test/src/CompareOutput.zig+2-3
......@@ -15,7 +15,7 @@ const Special = enum {
1515
1616const TestCase = struct {
1717 name: []const u8,
18 sources: ArrayList(SourceFile),
18 sources: std.array_list.Managed(SourceFile),
1919 expected_output: []const u8,
2020 link_libc: bool,
2121 special: Special,
......@@ -41,7 +41,7 @@ const TestCase = struct {
4141pub fn createExtra(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8, special: Special) TestCase {
4242 var tc = TestCase{
4343 .name = name,
44 .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator),
44 .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator),
4545 .expected_output = expected_output,
4646 .link_libc = false,
4747 .special = special,
......@@ -170,7 +170,6 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
170170
171171const CompareOutput = @This();
172172const std = @import("std");
173const ArrayList = std.ArrayList;
174173const mem = std.mem;
175174const fs = std.fs;
176175const OptimizeMode = std.builtin.OptimizeMode;
test/src/RunTranslatedC.zig+2-3
......@@ -6,7 +6,7 @@ target: std.Build.ResolvedTarget,
66
77const TestCase = struct {
88 name: []const u8,
9 sources: ArrayList(SourceFile),
9 sources: std.array_list.Managed(SourceFile),
1010 expected_stdout: []const u8,
1111 allow_warnings: bool,
1212
......@@ -34,7 +34,7 @@ pub fn create(
3434 const tc = self.b.allocator.create(TestCase) catch unreachable;
3535 tc.* = TestCase{
3636 .name = name,
37 .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator),
37 .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator),
3838 .expected_stdout = expected_stdout,
3939 .allow_warnings = allow_warnings,
4040 };
......@@ -103,7 +103,6 @@ pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void {
103103
104104const RunTranslatedCContext = @This();
105105const std = @import("std");
106const ArrayList = std.ArrayList;
107106const fmt = std.fmt;
108107const mem = std.mem;
109108const fs = std.fs;
test/src/TranslateC.zig+4-5
......@@ -6,8 +6,8 @@ test_target_filters: []const []const u8,
66
77const TestCase = struct {
88 name: []const u8,
9 sources: ArrayList(SourceFile),
10 expected_lines: ArrayList([]const u8),
9 sources: std.array_list.Managed(SourceFile),
10 expected_lines: std.array_list.Managed([]const u8),
1111 allow_warnings: bool,
1212 target: std.Target.Query = .{},
1313
......@@ -39,8 +39,8 @@ pub fn create(
3939 const tc = self.b.allocator.create(TestCase) catch unreachable;
4040 tc.* = TestCase{
4141 .name = name,
42 .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator),
43 .expected_lines = ArrayList([]const u8).init(self.b.allocator),
42 .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator),
43 .expected_lines = std.array_list.Managed([]const u8).init(self.b.allocator),
4444 .allow_warnings = allow_warnings,
4545 };
4646
......@@ -125,7 +125,6 @@ pub fn addCase(self: *TranslateCContext, case: *const TestCase) void {
125125
126126const TranslateCContext = @This();
127127const std = @import("std");
128const ArrayList = std.ArrayList;
129128const fmt = std.fmt;
130129const mem = std.mem;
131130const fs = std.fs;
test/src/check-stack-trace.zig+1-1
......@@ -24,7 +24,7 @@ pub fn main() !void {
2424 // - replace function name with symbolic string when optimize_mode != .Debug
2525 // - skip empty lines
2626 const got: []const u8 = got_result: {
27 var buf = std.ArrayList(u8).init(arena);
27 var buf = std.array_list.Managed(u8).init(arena);
2828 defer buf.deinit();
2929 if (stderr.len != 0 and stderr[stderr.len - 1] == '\n') stderr = stderr[0 .. stderr.len - 1];
3030 var it = mem.splitScalar(u8, stderr, '\n');
test/standalone/windows_argv/fuzz.zig+2-2
......@@ -41,7 +41,7 @@ pub fn main() !void {
4141 std.debug.print("rand seed: {}\n", .{seed});
4242 }
4343
44 var cmd_line_w_buf = std.ArrayList(u16).init(allocator);
44 var cmd_line_w_buf = std.array_list.Managed(u16).init(allocator);
4545 defer cmd_line_w_buf.deinit();
4646
4747 var i: u64 = 0;
......@@ -84,7 +84,7 @@ fn randomCommandLineW(allocator: Allocator, rand: std.Random) ![:0]const u16 {
8484 };
8585
8686 const choices = rand.uintAtMostBiased(u16, 256);
87 var buf = try std.ArrayList(u16).initCapacity(allocator, choices);
87 var buf = try std.array_list.Managed(u16).initCapacity(allocator, choices);
8888 errdefer buf.deinit();
8989
9090 for (0..choices) |_| {
test/standalone/windows_argv/lib.zig+1-1
......@@ -17,7 +17,7 @@ fn testArgv(expected_args: []const [*:0]const u16) !void {
1717 const allocator = arena_state.allocator();
1818
1919 const args = try std.process.argsAlloc(allocator);
20 var wtf8_buf = std.ArrayList(u8).init(allocator);
20 var wtf8_buf = std.array_list.Managed(u8).init(allocator);
2121
2222 var eql = true;
2323 if (args.len != expected_args.len) eql = false;
test/standalone/windows_bat_args/fuzz.zig+3-3
......@@ -42,7 +42,7 @@ pub fn main() anyerror!void {
4242 try tmp.dir.setAsCwd();
4343 defer tmp.parent_dir.setAsCwd() catch {};
4444
45 var buf = try std.ArrayList(u8).initCapacity(allocator, 128);
45 var buf = try std.array_list.Managed(u8).initCapacity(allocator, 128);
4646 defer buf.deinit();
4747 try buf.appendSlice("@echo off\n");
4848 try buf.append('"');
......@@ -80,7 +80,7 @@ fn testExec(allocator: std.mem.Allocator, args: []const []const u8, env: ?*std.p
8080}
8181
8282fn testExecBat(allocator: std.mem.Allocator, bat: []const u8, args: []const []const u8, env: ?*std.process.EnvMap) !void {
83 var argv = try std.ArrayList([]const u8).initCapacity(allocator, 1 + args.len);
83 var argv = try std.array_list.Managed([]const u8).initCapacity(allocator, 1 + args.len);
8484 defer argv.deinit();
8585 argv.appendAssumeCapacity(bat);
8686 argv.appendSliceAssumeCapacity(args);
......@@ -121,7 +121,7 @@ fn randomArg(allocator: Allocator, rand: std.Random) ![]const u8 {
121121 };
122122
123123 const choices = rand.uintAtMostBiased(u16, 256);
124 var buf = try std.ArrayList(u8).initCapacity(allocator, choices);
124 var buf = try std.array_list.Managed(u8).initCapacity(allocator, choices);
125125 errdefer buf.deinit();
126126
127127 var last_codepoint: u21 = 0;
test/standalone/windows_bat_args/test.zig+2-2
......@@ -16,7 +16,7 @@ pub fn main() anyerror!void {
1616 try tmp.dir.setAsCwd();
1717 defer tmp.parent_dir.setAsCwd() catch {};
1818
19 var buf = try std.ArrayList(u8).initCapacity(allocator, 128);
19 var buf = try std.array_list.Managed(u8).initCapacity(allocator, 128);
2020 defer buf.deinit();
2121 try buf.appendSlice("@echo off\n");
2222 try buf.append('"');
......@@ -127,7 +127,7 @@ fn testExec(allocator: std.mem.Allocator, args: []const []const u8, env: ?*std.p
127127}
128128
129129fn testExecBat(allocator: std.mem.Allocator, bat: []const u8, args: []const []const u8, env: ?*std.process.EnvMap) !void {
130 var argv = try std.ArrayList([]const u8).initCapacity(allocator, 1 + args.len);
130 var argv = try std.array_list.Managed([]const u8).initCapacity(allocator, 1 + args.len);
131131 defer argv.deinit();
132132 argv.appendAssumeCapacity(bat);
133133 argv.appendSliceAssumeCapacity(args);
tools/docgen.zig+5-5
......@@ -344,12 +344,12 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
344344 var last_action: Action = .open;
345345 var last_columns: ?u8 = null;
346346
347 var toc_buf = std.ArrayList(u8).init(allocator);
347 var toc_buf = std.array_list.Managed(u8).init(allocator);
348348 defer toc_buf.deinit();
349349
350350 var toc = toc_buf.writer();
351351
352 var nodes = std.ArrayList(Node).init(allocator);
352 var nodes = std.array_list.Managed(Node).init(allocator);
353353 defer nodes.deinit();
354354
355355 try toc.writeByte('\n');
......@@ -449,7 +449,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
449449 last_action = .close;
450450 }
451451 } else if (mem.eql(u8, tag_name, "see_also")) {
452 var list = std.ArrayList(SeeAlsoItem).init(allocator);
452 var list = std.array_list.Managed(SeeAlsoItem).init(allocator);
453453 errdefer list.deinit();
454454
455455 while (true) {
......@@ -599,7 +599,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
599599}
600600
601601fn urlize(allocator: Allocator, input: []const u8) ![]u8 {
602 var buf = std.ArrayList(u8).init(allocator);
602 var buf = std.array_list.Managed(u8).init(allocator);
603603 defer buf.deinit();
604604
605605 const out = buf.writer();
......@@ -618,7 +618,7 @@ fn urlize(allocator: Allocator, input: []const u8) ![]u8 {
618618}
619619
620620fn escapeHtml(allocator: Allocator, input: []const u8) ![]u8 {
621 var buf = std.ArrayList(u8).init(allocator);
621 var buf = std.array_list.Managed(u8).init(allocator);
622622 defer buf.deinit();
623623
624624 const out = buf.writer();
tools/doctest.zig+20-20
......@@ -126,7 +126,7 @@ fn printOutput(
126126 const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch);
127127 const print = std.debug.print;
128128
129 var shell_buffer = std.ArrayList(u8).init(arena);
129 var shell_buffer = std.array_list.Managed(u8).init(arena);
130130 defer shell_buffer.deinit();
131131 var shell_out = shell_buffer.writer();
132132
......@@ -134,7 +134,7 @@ fn printOutput(
134134
135135 switch (code.id) {
136136 .exe => |expected_outcome| code_block: {
137 var build_args = std.ArrayList([]const u8).init(arena);
137 var build_args = std.array_list.Managed([]const u8).init(arena);
138138 defer build_args.deinit();
139139 try build_args.appendSlice(&[_][]const u8{
140140 zig_exe, "build-exe",
......@@ -284,7 +284,7 @@ fn printOutput(
284284 try shell_out.writeAll("\n");
285285 },
286286 .@"test" => {
287 var test_args = std.ArrayList([]const u8).init(arena);
287 var test_args = std.array_list.Managed([]const u8).init(arena);
288288 defer test_args.deinit();
289289
290290 try test_args.appendSlice(&[_][]const u8{
......@@ -345,7 +345,7 @@ fn printOutput(
345345 try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout });
346346 },
347347 .test_error => |error_match| {
348 var test_args = std.ArrayList([]const u8).init(arena);
348 var test_args = std.array_list.Managed([]const u8).init(arena);
349349 defer test_args.deinit();
350350
351351 try test_args.appendSlice(&[_][]const u8{
......@@ -399,7 +399,7 @@ fn printOutput(
399399 try shell_out.print("\n{s}\n", .{colored_stderr});
400400 },
401401 .test_safety => |error_match| {
402 var test_args = std.ArrayList([]const u8).init(arena);
402 var test_args = std.array_list.Managed([]const u8).init(arena);
403403 defer test_args.deinit();
404404
405405 try test_args.appendSlice(&[_][]const u8{
......@@ -461,7 +461,7 @@ fn printOutput(
461461 },
462462 .obj => |maybe_error_match| {
463463 const name_plus_obj_ext = try std.fmt.allocPrint(arena, "{s}{s}", .{ code_name, obj_ext });
464 var build_args = std.ArrayList([]const u8).init(arena);
464 var build_args = std.array_list.Managed([]const u8).init(arena);
465465 defer build_args.deinit();
466466
467467 try build_args.appendSlice(&[_][]const u8{
......@@ -543,7 +543,7 @@ fn printOutput(
543543 .output_mode = .Lib,
544544 });
545545
546 var test_args = std.ArrayList([]const u8).init(arena);
546 var test_args = std.array_list.Managed([]const u8).init(arena);
547547 defer test_args.deinit();
548548
549549 try test_args.appendSlice(&[_][]const u8{
......@@ -975,7 +975,7 @@ fn skipPrefix(line: []const u8) []const u8 {
975975}
976976
977977fn escapeHtml(allocator: Allocator, input: []const u8) ![]u8 {
978 var buf = std.ArrayList(u8).init(allocator);
978 var buf = std.array_list.Managed(u8).init(allocator);
979979 defer buf.deinit();
980980
981981 const out = buf.writer();
......@@ -1011,7 +1011,7 @@ fn termColor(allocator: Allocator, input: []const u8) ![]u8 {
10111011 const supported_sgr_colors = [_]u8{ 31, 32, 36 };
10121012 const supported_sgr_numbers = [_]u8{ 0, 1, 2 };
10131013
1014 var buf = std.ArrayList(u8).init(allocator);
1014 var buf = std.array_list.Managed(u8).init(allocator);
10151015 defer buf.deinit();
10161016
10171017 var out = buf.writer();
......@@ -1401,7 +1401,7 @@ test "printShell" {
14011401 \\</samp></pre></figure>
14021402 ;
14031403
1404 var buffer = std.ArrayList(u8).init(test_allocator);
1404 var buffer = std.array_list.Managed(u8).init(test_allocator);
14051405 defer buffer.deinit();
14061406
14071407 try printShell(buffer.writer(), shell_out, false);
......@@ -1418,7 +1418,7 @@ test "printShell" {
14181418 \\</samp></pre></figure>
14191419 ;
14201420
1421 var buffer = std.ArrayList(u8).init(test_allocator);
1421 var buffer = std.array_list.Managed(u8).init(test_allocator);
14221422 defer buffer.deinit();
14231423
14241424 try printShell(buffer.writer(), shell_out, false);
......@@ -1432,7 +1432,7 @@ test "printShell" {
14321432 \\</samp></pre></figure>
14331433 ;
14341434
1435 var buffer = std.ArrayList(u8).init(test_allocator);
1435 var buffer = std.array_list.Managed(u8).init(test_allocator);
14361436 defer buffer.deinit();
14371437
14381438 try printShell(buffer.writer(), shell_out, false);
......@@ -1451,7 +1451,7 @@ test "printShell" {
14511451 \\</samp></pre></figure>
14521452 ;
14531453
1454 var buffer = std.ArrayList(u8).init(test_allocator);
1454 var buffer = std.array_list.Managed(u8).init(test_allocator);
14551455 defer buffer.deinit();
14561456
14571457 try printShell(buffer.writer(), shell_out, false);
......@@ -1472,7 +1472,7 @@ test "printShell" {
14721472 \\</samp></pre></figure>
14731473 ;
14741474
1475 var buffer = std.ArrayList(u8).init(test_allocator);
1475 var buffer = std.array_list.Managed(u8).init(test_allocator);
14761476 defer buffer.deinit();
14771477
14781478 try printShell(buffer.writer(), shell_out, false);
......@@ -1491,7 +1491,7 @@ test "printShell" {
14911491 \\</samp></pre></figure>
14921492 ;
14931493
1494 var buffer = std.ArrayList(u8).init(test_allocator);
1494 var buffer = std.array_list.Managed(u8).init(test_allocator);
14951495 defer buffer.deinit();
14961496
14971497 try printShell(buffer.writer(), shell_out, false);
......@@ -1514,7 +1514,7 @@ test "printShell" {
15141514 \\</samp></pre></figure>
15151515 ;
15161516
1517 var buffer = std.ArrayList(u8).init(test_allocator);
1517 var buffer = std.array_list.Managed(u8).init(test_allocator);
15181518 defer buffer.deinit();
15191519
15201520 try printShell(buffer.writer(), shell_out, false);
......@@ -1536,7 +1536,7 @@ test "printShell" {
15361536 \\</samp></pre></figure>
15371537 ;
15381538
1539 var buffer = std.ArrayList(u8).init(test_allocator);
1539 var buffer = std.array_list.Managed(u8).init(test_allocator);
15401540 defer buffer.deinit();
15411541
15421542 try printShell(buffer.writer(), shell_out, false);
......@@ -1553,7 +1553,7 @@ test "printShell" {
15531553 \\</samp></pre></figure>
15541554 ;
15551555
1556 var buffer = std.ArrayList(u8).init(test_allocator);
1556 var buffer = std.array_list.Managed(u8).init(test_allocator);
15571557 defer buffer.deinit();
15581558
15591559 try printShell(buffer.writer(), shell_out, false);
......@@ -1572,7 +1572,7 @@ test "printShell" {
15721572 \\</samp></pre></figure>
15731573 ;
15741574
1575 var buffer = std.ArrayList(u8).init(test_allocator);
1575 var buffer = std.array_list.Managed(u8).init(test_allocator);
15761576 defer buffer.deinit();
15771577
15781578 try printShell(buffer.writer(), shell_out, false);
......@@ -1587,7 +1587,7 @@ test "printShell" {
15871587 \\</samp></pre></figure>
15881588 ;
15891589
1590 var buffer = std.ArrayList(u8).init(test_allocator);
1590 var buffer = std.array_list.Managed(u8).init(test_allocator);
15911591 defer buffer.deinit();
15921592
15931593 try printShell(buffer.writer(), shell_out, false);
tools/fetch_them_macos_headers.zig+2-2
......@@ -73,7 +73,7 @@ pub fn main() anyerror!void {
7373
7474 const args = try std.process.argsAlloc(allocator);
7575
76 var argv = std.ArrayList([]const u8).init(allocator);
76 var argv = std.array_list.Managed([]const u8).init(allocator);
7777 var sysroot: ?[]const u8 = null;
7878
7979 var args_iter = ArgsIterator{ .args = args[1..] };
......@@ -145,7 +145,7 @@ fn fetchTarget(
145145 ver.minor,
146146 });
147147
148 var cc_argv = std.ArrayList([]const u8).init(arena);
148 var cc_argv = std.array_list.Managed([]const u8).init(arena);
149149 try cc_argv.appendSlice(&[_][]const u8{
150150 "cc",
151151 "-arch",
tools/gen_macos_headers_c.zig+3-3
......@@ -23,7 +23,7 @@ pub fn main() anyerror!void {
2323 const args = try std.process.argsAlloc(arena);
2424 if (args.len == 1) fatal("no command or option specified", .{});
2525
26 var positionals = std.ArrayList([]const u8).init(arena);
26 var positionals = std.array_list.Managed([]const u8).init(arena);
2727
2828 for (args[1..]) |arg| {
2929 if (std.mem.eql(u8, arg, "--help") or std.mem.eql(u8, arg, "-h")) {
......@@ -35,7 +35,7 @@ pub fn main() anyerror!void {
3535
3636 var dir = try std.fs.cwd().openDir(positionals.items[0], .{ .no_follow = true });
3737 defer dir.close();
38 var paths = std.ArrayList([]const u8).init(arena);
38 var paths = std.array_list.Managed([]const u8).init(arena);
3939 try findHeaders(arena, dir, "", &paths);
4040
4141 const SortFn = struct {
......@@ -66,7 +66,7 @@ fn findHeaders(
6666 arena: Allocator,
6767 dir: std.fs.Dir,
6868 prefix: []const u8,
69 paths: *std.ArrayList([]const u8),
69 paths: *std.array_list.Managed([]const u8),
7070) anyerror!void {
7171 var it = dir.iterate();
7272 while (try it.next()) |entry| {
tools/gen_outline_atomics.zig+1-1
......@@ -37,7 +37,7 @@ pub fn main() !void {
3737 \\
3838 );
3939
40 var footer = std.ArrayList(u8).init(arena);
40 var footer = std.array_list.Managed(u8).init(arena);
4141 try footer.appendSlice("\ncomptime {\n");
4242
4343 for ([_]N{ .one, .two, .four, .eight, .sixteen }) |n| {
tools/gen_spirv_spec.zig+5-7
......@@ -69,7 +69,7 @@ pub fn main() !void {
6969 const core_spec = try readRegistry(CoreRegistry, dir, "spirv.core.grammar.json");
7070 std.mem.sortUnstable(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt);
7171
72 var exts = std.ArrayList(Extension).init(allocator);
72 var exts = std.array_list.Managed(Extension).init(allocator);
7373
7474 var it = dir.iterate();
7575 while (try it.next()) |entry| {
......@@ -113,7 +113,7 @@ pub fn main() !void {
113113 _ = try std.fs.File.stdout().write(formatted_output);
114114}
115115
116fn readExtRegistry(exts: *std.ArrayList(Extension), dir: std.fs.Dir, sub_path: []const u8) !void {
116fn readExtRegistry(exts: *std.array_list.Managed(Extension), dir: std.fs.Dir, sub_path: []const u8) !void {
117117 const filename = std.fs.path.basename(sub_path);
118118 if (!std.mem.startsWith(u8, filename, "extinst.")) {
119119 return;
......@@ -296,8 +296,6 @@ fn render(
296296 );
297297
298298 // Merge the operand kinds from all extensions together.
299 // var all_operand_kinds = std.ArrayList(OperandKind).init(a);
300 // try all_operand_kinds.appendSlice(registry.operand_kinds);
301299 var all_operand_kinds = OperandKindMap.init(allocator);
302300 for (registry.operand_kinds) |kind| {
303301 try all_operand_kinds.putNoClobber(.{ "core", kind.kind }, kind);
......@@ -544,7 +542,7 @@ fn renderOpcodes(
544542 var inst_map = std.AutoArrayHashMap(u32, usize).init(allocator);
545543 try inst_map.ensureTotalCapacity(instructions.len);
546544
547 var aliases = std.ArrayList(struct { inst: usize, alias: usize }).init(allocator);
545 var aliases = std.array_list.Managed(struct { inst: usize, alias: usize }).init(allocator);
548546 try aliases.ensureTotalCapacity(instructions.len);
549547
550548 for (instructions, 0..) |inst, i| {
......@@ -657,7 +655,7 @@ fn renderValueEnum(
657655 var enum_map = std.AutoArrayHashMap(u32, usize).init(allocator);
658656 try enum_map.ensureTotalCapacity(enumerants.len);
659657
660 var aliases = std.ArrayList(struct { enumerant: usize, alias: usize }).init(allocator);
658 var aliases = std.array_list.Managed(struct { enumerant: usize, alias: usize }).init(allocator);
661659 try aliases.ensureTotalCapacity(enumerants.len);
662660
663661 for (enumerants, 0..) |enumerant, i| {
......@@ -735,7 +733,7 @@ fn renderBitEnum(
735733 var flags_by_bitpos = [_]?usize{null} ** 32;
736734 const enumerants = enumeration.enumerants orelse return error.InvalidRegistry;
737735
738 var aliases = std.ArrayList(struct { flag: usize, alias: u5 }).init(allocator);
736 var aliases = std.array_list.Managed(struct { flag: usize, alias: u5 }).init(allocator);
739737 try aliases.ensureTotalCapacity(enumerants.len);
740738
741739 for (enumerants, 0..) |enumerant, i| {
tools/generate_JSONTestSuite.zig+1-1
......@@ -19,7 +19,7 @@ pub fn main() !void {
1919 \\
2020 );
2121
22 var names = std.ArrayList([]const u8).init(allocator);
22 var names = std.array_list.Managed([]const u8).init(allocator);
2323 var cwd = try std.fs.cwd().openDir(".", .{ .iterate = true });
2424 var it = cwd.iterate();
2525 while (try it.next()) |entry| {
tools/generate_linux_syscalls.zig+1-1
......@@ -591,7 +591,7 @@ fn generateSyscallsFromTable(
591591
592592 const table = try linux_dir.readFile(arch_info.file_path, buf);
593593
594 var optional_array_list: ?std.ArrayList(u8) = if (arch_info.additional_enum) |_| std.ArrayList(u8).init(allocator) else null;
594 var optional_array_list: ?std.array_list.Managed(u8) = if (arch_info.additional_enum) |_| std.array_list.Managed(u8).init(allocator) else null;
595595 const optional_writer = if (optional_array_list) |_| optional_array_list.?.writer() else null;
596596
597597 try writer.print("pub const {s} = enum(usize) {{\n", .{arch_info.enum_name});
tools/migrate_langref.zig+3-3
......@@ -319,13 +319,13 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype
319319 }
320320
321321 var mode: std.builtin.OptimizeMode = .Debug;
322 var link_objects = std.ArrayList([]const u8).init(arena);
322 var link_objects = std.array_list.Managed([]const u8).init(arena);
323323 var target_str: ?[]const u8 = null;
324324 var link_libc = false;
325325 var link_mode: ?std.builtin.LinkMode = null;
326326 var disable_cache = false;
327327 var verbose_cimport = false;
328 var additional_options = std.ArrayList([]const u8).init(arena);
328 var additional_options = std.array_list.Managed([]const u8).init(arena);
329329
330330 const source_token = while (true) {
331331 const content_tok = try eatToken(tokenizer, .content);
......@@ -437,7 +437,7 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype
437437}
438438
439439fn urlize(allocator: Allocator, input: []const u8) ![]u8 {
440 var buf = std.ArrayList(u8).init(allocator);
440 var buf = std.array_list.Managed(u8).init(allocator);
441441 defer buf.deinit();
442442
443443 const out = buf.writer();
tools/process_headers.zig+3-3
......@@ -130,7 +130,7 @@ pub fn main() !void {
130130 var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
131131 const allocator = arena.allocator();
132132 const args = try std.process.argsAlloc(allocator);
133 var search_paths = std.ArrayList([]const u8).init(allocator);
133 var search_paths = std.array_list.Managed([]const u8).init(allocator);
134134 var opt_out_dir: ?[]const u8 = null;
135135 var opt_abi: ?[]const u8 = null;
136136
......@@ -234,7 +234,7 @@ pub fn main() !void {
234234 .musl => &[_][]const u8{ search_path, libc_dir, "usr", "local", "musl", "include" },
235235 };
236236 const target_include_dir = try std.fs.path.join(allocator, sub_path);
237 var dir_stack = std.ArrayList([]const u8).init(allocator);
237 var dir_stack = std.array_list.Managed([]const u8).init(allocator);
238238 try dir_stack.append(target_include_dir);
239239
240240 while (dir_stack.pop()) |full_dir_name| {
......@@ -323,7 +323,7 @@ pub fn main() !void {
323323 // gets their header in a separate arch directory.
324324 var path_it = path_table.iterator();
325325 while (path_it.next()) |path_kv| {
326 var contents_list = std.ArrayList(*Contents).init(allocator);
326 var contents_list = std.array_list.Managed(*Contents).init(allocator);
327327 {
328328 var hash_it = path_kv.value_ptr.*.iterator();
329329 while (hash_it.next()) |hash_kv| {
tools/update-linux-headers.zig+3-3
......@@ -143,7 +143,7 @@ pub fn main() !void {
143143 var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
144144 const arena = arena_state.allocator();
145145 const args = try std.process.argsAlloc(arena);
146 var search_paths = std.ArrayList([]const u8).init(arena);
146 var search_paths = std.array_list.Managed([]const u8).init(arena);
147147 var opt_out_dir: ?[]const u8 = null;
148148
149149 var arg_i: usize = 1;
......@@ -186,7 +186,7 @@ pub fn main() !void {
186186 const target_include_dir = try std.fs.path.join(arena, &.{
187187 search_path, linux_target.name, "include",
188188 });
189 var dir_stack = std.ArrayList([]const u8).init(arena);
189 var dir_stack = std.array_list.Managed([]const u8).init(arena);
190190 try dir_stack.append(target_include_dir);
191191
192192 while (dir_stack.pop()) |full_dir_name| {
......@@ -261,7 +261,7 @@ pub fn main() !void {
261261 // gets their header in a separate arch directory.
262262 var path_it = path_table.iterator();
263263 while (path_it.next()) |path_kv| {
264 var contents_list = std.ArrayList(*Contents).init(arena);
264 var contents_list = std.array_list.Managed(*Contents).init(arena);
265265 {
266266 var hash_it = path_kv.value_ptr.*.iterator();
267267 while (hash_it.next()) |hash_kv| {
tools/update_clang_options.zig+1-1
......@@ -699,7 +699,7 @@ pub fn main() anyerror!void {
699699 defer parsed.deinit();
700700 const root_map = &parsed.value.object;
701701
702 var all_objects = std.ArrayList(*json.ObjectMap).init(allocator);
702 var all_objects = std.array_list.Managed(*json.ObjectMap).init(allocator);
703703 {
704704 var it = root_map.iterator();
705705 it_map: while (it.next()) |kv| {
tools/update_cpu_features.zig+6-6
......@@ -1634,8 +1634,8 @@ fn processOneTarget(job: Job) void {
16341634 defer progress_node.end();
16351635
16361636 var features_table = std.StringHashMap(Feature).init(arena);
1637 var all_features = std.ArrayList(Feature).init(arena);
1638 var all_cpus = std.ArrayList(Cpu).init(arena);
1637 var all_features = std.array_list.Managed(Feature).init(arena);
1638 var all_cpus = std.array_list.Managed(Cpu).init(arena);
16391639
16401640 if (target.llvm) |llvm| {
16411641 const tblgen_progress = progress_node.start("running llvm-tblgen", 0);
......@@ -1726,7 +1726,7 @@ fn processOneTarget(job: Job) void {
17261726
17271727 var zig_name = try llvmNameToZigName(arena, llvm_name);
17281728 var desc = kv.value_ptr.object.get("Desc").?.string;
1729 var deps = std.ArrayList([]const u8).init(arena);
1729 var deps = std.array_list.Managed([]const u8).init(arena);
17301730 var omit = false;
17311731 var flatten = false;
17321732 var omit_deps: []const []const u8 = &.{};
......@@ -1810,7 +1810,7 @@ fn processOneTarget(job: Job) void {
18101810 if (omitted) continue;
18111811
18121812 var zig_name = try llvmNameToZigName(arena, llvm_name);
1813 var deps = std.ArrayList([]const u8).init(arena);
1813 var deps = std.array_list.Managed([]const u8).init(arena);
18141814 var omit_deps: []const []const u8 = &.{};
18151815 var extra_deps: []const []const u8 = &.{};
18161816 for (target.feature_overrides) |feature_override| {
......@@ -1979,7 +1979,7 @@ fn processOneTarget(job: Job) void {
19791979 try putDep(&deps_set, features_table, dep);
19801980 }
19811981 try pruneFeatures(arena, features_table, &deps_set);
1982 var dependencies = std.ArrayList([]const u8).init(arena);
1982 var dependencies = std.array_list.Managed([]const u8).init(arena);
19831983 {
19841984 var it = deps_set.keyIterator();
19851985 while (it.next()) |key| {
......@@ -2024,7 +2024,7 @@ fn processOneTarget(job: Job) void {
20242024 try putDep(&deps_set, features_table, feature_zig_name);
20252025 }
20262026 try pruneFeatures(arena, features_table, &deps_set);
2027 var cpu_features = std.ArrayList([]const u8).init(arena);
2027 var cpu_features = std.array_list.Managed([]const u8).init(arena);
20282028 {
20292029 var it = deps_set.keyIterator();
20302030 while (it.next()) |key| {
tools/update_crc_catalog.zig+1-1
......@@ -139,7 +139,7 @@ pub fn main() anyerror!void {
139139 _ = mem.replace(u8, snakecase, "-", "_", snakecase);
140140 _ = mem.replace(u8, snakecase, "/", "_", snakecase);
141141
142 var buf = try std.ArrayList(u8).initCapacity(arena, snakecase.len);
142 var buf = try std.array_list.Managed(u8).initCapacity(arena, snakecase.len);
143143 defer buf.deinit();
144144
145145 var prev: u8 = 0;