| author | |
| committer | |
| log | 749f10af49022597d873d41df5c600e97e5c4a37 |
| tree | cb6da80d28fa284bdeb7b40d26ce8de9ca9b2306 |
| parent | d625158354a02a18e9ae7975a144f30838884d5c |
161 files changed, 861 insertions(+), 870 deletions(-)
build.zig+1-2| ... | @@ -3,7 +3,6 @@ const builtin = std.builtin; | ... | @@ -3,7 +3,6 @@ const builtin = std.builtin; |
| 3 | const tests = @import("test/tests.zig"); | 3 | const tests = @import("test/tests.zig"); |
| 4 | const BufMap = std.BufMap; | 4 | const BufMap = std.BufMap; |
| 5 | const mem = std.mem; | 5 | const mem = std.mem; |
| 6 | const ArrayList = std.ArrayList; | ||
| 7 | const io = std.io; | 6 | const io = std.io; |
| 8 | const fs = std.fs; | 7 | const fs = std.fs; |
| 9 | const InstallDirectoryOptions = std.Build.InstallDirectoryOptions; | 8 | const InstallDirectoryOptions = std.Build.InstallDirectoryOptions; |
| ... | @@ -925,7 +924,7 @@ fn addCxxKnownPath( | ... | @@ -925,7 +924,7 @@ fn addCxxKnownPath( |
| 925 | return error.RequiredLibraryNotFound; | 924 | return error.RequiredLibraryNotFound; |
| 926 | 925 | ||
| 927 | const path_padded = run: { | 926 | 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); |
| 929 | try args.append(ctx.cxx_compiler); | 928 | try args.append(ctx.cxx_compiler); |
| 930 | var it = std.mem.tokenizeAny(u8, ctx.cxx_compiler_arg1, &std.ascii.whitespace); | 929 | var it = std.mem.tokenizeAny(u8, ctx.cxx_compiler_arg1, &std.ascii.whitespace); |
| 931 | while (it.next()) |arg| try args.append(arg); | 930 | 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 | ... | @@ -6241,9 +6241,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 6241 | C has a default allocator - <code>malloc</code>, <code>realloc</code>, and <code>free</code>. | 6241 | C has a default allocator - <code>malloc</code>, <code>realloc</code>, and <code>free</code>. |
| 6242 | When linking against libc, Zig exposes this allocator with {#syntax#}std.heap.c_allocator{#endsyntax#}. | 6242 | When linking against libc, Zig exposes this allocator with {#syntax#}std.heap.c_allocator{#endsyntax#}. |
| 6243 | However, by convention, there is no default allocator in Zig. Instead, functions which need to | 6243 | 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 | 6244 | allocate accept an {#syntax#}Allocator{#endsyntax#} parameter. Likewise, some data structures |
| 6245 | {#syntax#}std.ArrayList{#endsyntax#} accept an {#syntax#}Allocator{#endsyntax#} parameter in | 6245 | accept an {#syntax#}Allocator{#endsyntax#} parameter in their initialization functions: |
| 6246 | their initialization functions: | ||
| 6247 | </p> | 6246 | </p> |
| 6248 | {#code|test_allocator.zig#} | 6247 | {#code|test_allocator.zig#} |
| 6249 | 6248 |
doc/langref/testing_detect_leak.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | test "detect leak" { | 3 | test "detect leak" { |
| 4 | var list = std.ArrayList(u21).init(std.testing.allocator); | 4 | var list = std.array_list.Managed(u21).init(std.testing.allocator); |
| 5 | // missing `defer list.deinit();` | 5 | // missing `defer list.deinit();` |
| 6 | try list.append('☔'); | 6 | try list.append('☔'); |
| 7 | 7 |
lib/compiler/aro/aro/Compilation.zig+3-3| ... | @@ -533,7 +533,7 @@ fn generateSystemDefines(comp: *Compilation, w: anytype) !void { | ... | @@ -533,7 +533,7 @@ fn generateSystemDefines(comp: *Compilation, w: anytype) !void { |
| 533 | pub fn generateBuiltinMacros(comp: *Compilation, system_defines_mode: SystemDefinesMode) !Source { | 533 | pub fn generateBuiltinMacros(comp: *Compilation, system_defines_mode: SystemDefinesMode) !Source { |
| 534 | try comp.generateBuiltinTypes(); | 534 | try comp.generateBuiltinTypes(); |
| 535 | 535 | ||
| 536 | var buf = std.ArrayList(u8).init(comp.gpa); | 536 | var buf = std.array_list.Managed(u8).init(comp.gpa); |
| 537 | defer buf.deinit(); | 537 | defer buf.deinit(); |
| 538 | 538 | ||
| 539 | if (system_defines_mode == .include_system_defines) { | 539 | if (system_defines_mode == .include_system_defines) { |
| ... | @@ -1143,7 +1143,7 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, buf: []u8, path: []const u8, | ... | @@ -1143,7 +1143,7 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, buf: []u8, path: []const u8, |
| 1143 | const duped_path = try comp.gpa.dupe(u8, path); | 1143 | const duped_path = try comp.gpa.dupe(u8, path); |
| 1144 | errdefer comp.gpa.free(duped_path); | 1144 | errdefer comp.gpa.free(duped_path); |
| 1145 | 1145 | ||
| 1146 | var splice_list = std.ArrayList(u32).init(comp.gpa); | 1146 | var splice_list = std.array_list.Managed(u32).init(comp.gpa); |
| 1147 | defer splice_list.deinit(); | 1147 | defer splice_list.deinit(); |
| 1148 | 1148 | ||
| 1149 | const source_id: Source.Id = @enumFromInt(comp.sources.count() + 2); | 1149 | 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 | ... | @@ -1428,7 +1428,7 @@ fn getFileContents(comp: *Compilation, path: []const u8, limit: ?u32) ![]const u |
| 1428 | const file = try comp.cwd.openFile(path, .{}); | 1428 | const file = try comp.cwd.openFile(path, .{}); |
| 1429 | defer file.close(); | 1429 | defer file.close(); |
| 1430 | 1430 | ||
| 1431 | var buf = std.ArrayList(u8).init(comp.gpa); | 1431 | var buf = std.array_list.Managed(u8).init(comp.gpa); |
| 1432 | defer buf.deinit(); | 1432 | defer buf.deinit(); |
| 1433 | 1433 | ||
| 1434 | const max = limit orelse std.math.maxInt(u32); | 1434 | 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; | ... | @@ -590,7 +590,7 @@ var stdout_buffer: [4096]u8 = undefined; |
| 590 | /// The entry point of the Aro compiler. | 590 | /// The entry point of the Aro compiler. |
| 591 | /// **MAY call `exit` if `fast_exit` is set.** | 591 | /// **MAY call `exit` if `fast_exit` is set.** |
| 592 | pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_exit: bool) !void { | 592 | pub 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); |
| 594 | defer macro_buf.deinit(); | 594 | defer macro_buf.deinit(); |
| 595 | 595 | ||
| 596 | const std_out = std.fs.File.stdout().deprecatedWriter(); | 596 | const std_out = std.fs.File.stdout().deprecatedWriter(); |
| ... | @@ -817,7 +817,7 @@ fn dumpLinkerArgs(items: []const []const u8) !void { | ... | @@ -817,7 +817,7 @@ fn dumpLinkerArgs(items: []const []const u8) !void { |
| 817 | /// The entry point of the Aro compiler. | 817 | /// The entry point of the Aro compiler. |
| 818 | /// **MAY call `exit` if `fast_exit` is set.** | 818 | /// **MAY call `exit` if `fast_exit` is set.** |
| 819 | pub fn invokeLinker(d: *Driver, tc: *Toolchain, comptime fast_exit: bool) !void { | 819 | pub 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); |
| 821 | defer argv.deinit(); | 821 | defer argv.deinit(); |
| 822 | 822 | ||
| 823 | var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined; | 823 | 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; | ... | @@ -9,7 +9,7 @@ const TokenIndex = Tree.TokenIndex; |
| 9 | const NodeIndex = Tree.NodeIndex; | 9 | const NodeIndex = Tree.NodeIndex; |
| 10 | const Type = @import("Type.zig"); | 10 | const Type = @import("Type.zig"); |
| 11 | const Diagnostics = @import("Diagnostics.zig"); | 11 | const Diagnostics = @import("Diagnostics.zig"); |
| 12 | const NodeList = std.ArrayList(NodeIndex); | 12 | const NodeList = std.array_list.Managed(NodeIndex); |
| 13 | const Parser = @import("Parser.zig"); | 13 | const Parser = @import("Parser.zig"); |
| 14 | 14 | ||
| 15 | const Item = struct { | 15 | const Item = struct { |
lib/compiler/aro/aro/Parser.zig+19-19| ... | @@ -15,7 +15,7 @@ const TokenIndex = Tree.TokenIndex; | ... | @@ -15,7 +15,7 @@ const TokenIndex = Tree.TokenIndex; |
| 15 | const NodeIndex = Tree.NodeIndex; | 15 | const NodeIndex = Tree.NodeIndex; |
| 16 | const Type = @import("Type.zig"); | 16 | const Type = @import("Type.zig"); |
| 17 | const Diagnostics = @import("Diagnostics.zig"); | 17 | const Diagnostics = @import("Diagnostics.zig"); |
| 18 | const NodeList = std.ArrayList(NodeIndex); | 18 | const NodeList = std.array_list.Managed(NodeIndex); |
| 19 | const InitList = @import("InitList.zig"); | 19 | const InitList = @import("InitList.zig"); |
| 20 | const Attribute = @import("Attribute.zig"); | 20 | const Attribute = @import("Attribute.zig"); |
| 21 | const char_info = @import("char_info.zig"); | 21 | const char_info = @import("char_info.zig"); |
| ... | @@ -33,7 +33,7 @@ const target_util = @import("target.zig"); | ... | @@ -33,7 +33,7 @@ const target_util = @import("target.zig"); |
| 33 | 33 | ||
| 34 | const Switch = struct { | 34 | const Switch = struct { |
| 35 | default: ?TokenIndex = null, | 35 | default: ?TokenIndex = null, |
| 36 | ranges: std.ArrayList(Range), | 36 | ranges: std.array_list.Managed(Range), |
| 37 | ty: Type, | 37 | ty: Type, |
| 38 | comp: *Compilation, | 38 | comp: *Compilation, |
| 39 | 39 | ||
| ... | @@ -101,16 +101,16 @@ value_map: Tree.ValueMap, | ... | @@ -101,16 +101,16 @@ value_map: Tree.ValueMap, |
| 101 | 101 | ||
| 102 | // buffers used during compilation | 102 | // buffers used during compilation |
| 103 | syms: SymbolStack = .{}, | 103 | syms: SymbolStack = .{}, |
| 104 | strings: std.ArrayListAligned(u8, .@"4"), | 104 | strings: std.array_list.AlignedManaged(u8, .@"4"), |
| 105 | labels: std.ArrayList(Label), | 105 | labels: std.array_list.Managed(Label), |
| 106 | list_buf: NodeList, | 106 | list_buf: NodeList, |
| 107 | decl_buf: NodeList, | 107 | decl_buf: NodeList, |
| 108 | param_buf: std.ArrayList(Type.Func.Param), | 108 | param_buf: std.array_list.Managed(Type.Func.Param), |
| 109 | enum_buf: std.ArrayList(Type.Enum.Field), | 109 | enum_buf: std.array_list.Managed(Type.Enum.Field), |
| 110 | record_buf: std.ArrayList(Type.Record.Field), | 110 | record_buf: std.array_list.Managed(Type.Record.Field), |
| 111 | attr_buf: std.MultiArrayList(TentativeAttribute) = .{}, | 111 | attr_buf: std.MultiArrayList(TentativeAttribute) = .{}, |
| 112 | attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty, | 112 | attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty, |
| 113 | field_attr_buf: std.ArrayList([]const Attribute), | 113 | field_attr_buf: std.array_list.Managed([]const Attribute), |
| 114 | /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) | 114 | /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) |
| 115 | /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. | 115 | /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. |
| 116 | /// The key is the StringId of `Foo` and the value is the TokenIndex of `bar` | 116 | /// 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 { | ... | @@ -693,16 +693,16 @@ pub fn parse(pp: *Preprocessor) Compilation.Error!Tree { |
| 693 | .gpa = pp.comp.gpa, | 693 | .gpa = pp.comp.gpa, |
| 694 | .arena = arena.allocator(), | 694 | .arena = arena.allocator(), |
| 695 | .tok_ids = pp.tokens.items(.id), | 695 | .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), |
| 697 | .value_map = Tree.ValueMap.init(pp.comp.gpa), | 697 | .value_map = Tree.ValueMap.init(pp.comp.gpa), |
| 698 | .data = NodeList.init(pp.comp.gpa), | 698 | .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), |
| 700 | .list_buf = NodeList.init(pp.comp.gpa), | 700 | .list_buf = NodeList.init(pp.comp.gpa), |
| 701 | .decl_buf = NodeList.init(pp.comp.gpa), | 701 | .decl_buf = NodeList.init(pp.comp.gpa), |
| 702 | .param_buf = std.ArrayList(Type.Func.Param).init(pp.comp.gpa), | 702 | .param_buf = std.array_list.Managed(Type.Func.Param).init(pp.comp.gpa), |
| 703 | .enum_buf = std.ArrayList(Type.Enum.Field).init(pp.comp.gpa), | 703 | .enum_buf = std.array_list.Managed(Type.Enum.Field).init(pp.comp.gpa), |
| 704 | .record_buf = std.ArrayList(Type.Record.Field).init(pp.comp.gpa), | 704 | .record_buf = std.array_list.Managed(Type.Record.Field).init(pp.comp.gpa), |
| 705 | .field_attr_buf = std.ArrayList([]const Attribute).init(pp.comp.gpa), | 705 | .field_attr_buf = std.array_list.Managed([]const Attribute).init(pp.comp.gpa), |
| 706 | .string_ids = .{ | 706 | .string_ids = .{ |
| 707 | .declspec_id = try StrInt.intern(pp.comp, "__declspec"), | 707 | .declspec_id = try StrInt.intern(pp.comp, "__declspec"), |
| 708 | .main_id = try StrInt.intern(pp.comp, "main"), | 708 | .main_id = try StrInt.intern(pp.comp, "main"), |
| ... | @@ -1222,7 +1222,7 @@ fn staticAssertMessage(p: *Parser, cond_node: NodeIndex, message: Result) !?[]co | ... | @@ -1222,7 +1222,7 @@ fn staticAssertMessage(p: *Parser, cond_node: NodeIndex, message: Result) !?[]co |
| 1222 | const cond_tag = p.nodes.items(.tag)[@intFromEnum(cond_node)]; | 1222 | const cond_tag = p.nodes.items(.tag)[@intFromEnum(cond_node)]; |
| 1223 | if (cond_tag != .builtin_types_compatible_p and message.node == .none) return null; | 1223 | if (cond_tag != .builtin_types_compatible_p and message.node == .none) return null; |
| 1224 | 1224 | ||
| 1225 | var buf = std.ArrayList(u8).init(p.gpa); | 1225 | var buf = std.array_list.Managed(u8).init(p.gpa); |
| 1226 | defer buf.deinit(); | 1226 | defer buf.deinit(); |
| 1227 | 1227 | ||
| 1228 | if (cond_tag == .builtin_types_compatible_p) { | 1228 | if (cond_tag == .builtin_types_compatible_p) { |
| ... | @@ -3994,7 +3994,7 @@ fn msvcAsmStmt(p: *Parser) Error!?NodeIndex { | ... | @@ -3994,7 +3994,7 @@ fn msvcAsmStmt(p: *Parser) Error!?NodeIndex { |
| 3994 | } | 3994 | } |
| 3995 | 3995 | ||
| 3996 | /// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')' | 3996 | /// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')' |
| 3997 | fn asmOperand(p: *Parser, names: *std.ArrayList(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void { | 3997 | fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void { |
| 3998 | if (p.eatToken(.l_bracket)) |l_bracket| { | 3998 | if (p.eatToken(.l_bracket)) |l_bracket| { |
| 3999 | const ident = (try p.eatIdentifier()) orelse { | 3999 | const ident = (try p.eatIdentifier()) orelse { |
| 4000 | try p.err(.expected_identifier); | 4000 | try p.err(.expected_identifier); |
| ... | @@ -4044,7 +4044,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex | ... | @@ -4044,7 +4044,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex |
| 4044 | const allocator = stack_fallback.get(); | 4044 | const allocator = stack_fallback.get(); |
| 4045 | 4045 | ||
| 4046 | // TODO: Consider using a TokenIndex of 0 instead of null if we need to store the names in the tree | 4046 | // 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 |
| 4048 | defer names.deinit(); | 4048 | defer names.deinit(); |
| 4049 | var constraints = NodeList.initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded | 4049 | var constraints = NodeList.initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded |
| 4050 | defer constraints.deinit(); | 4050 | defer constraints.deinit(); |
| ... | @@ -4317,7 +4317,7 @@ fn stmt(p: *Parser) Error!NodeIndex { | ... | @@ -4317,7 +4317,7 @@ fn stmt(p: *Parser) Error!NodeIndex { |
| 4317 | 4317 | ||
| 4318 | const old_switch = p.@"switch"; | 4318 | const old_switch = p.@"switch"; |
| 4319 | var @"switch" = Switch{ | 4319 | var @"switch" = Switch{ |
| 4320 | .ranges = std.ArrayList(Switch.Range).init(p.gpa), | 4320 | .ranges = std.array_list.Managed(Switch.Range).init(p.gpa), |
| 4321 | .ty = cond.ty, | 4321 | .ty = cond.ty, |
| 4322 | .comp = p.comp, | 4322 | .comp = p.comp, |
| 4323 | }; | 4323 | }; |
| ... | @@ -8268,7 +8268,7 @@ fn charLiteral(p: *Parser) Error!Result { | ... | @@ -8268,7 +8268,7 @@ fn charLiteral(p: *Parser) Error!Result { |
| 8268 | 8268 | ||
| 8269 | const max_chars_expected = 4; | 8269 | const max_chars_expected = 4; |
| 8270 | var stack_fallback = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), p.comp.gpa); | 8270 | 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 |
| 8272 | defer chars.deinit(); | 8272 | defer chars.deinit(); |
| 8273 | 8273 | ||
| 8274 | while (char_literal_parser.next()) |item| switch (item) { | 8274 | 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"); | ... | @@ -17,7 +17,7 @@ const features = @import("features.zig"); |
| 17 | const Hideset = @import("Hideset.zig"); | 17 | const Hideset = @import("Hideset.zig"); |
| 18 | 18 | ||
| 19 | const DefineMap = std.StringHashMapUnmanaged(Macro); | 19 | const DefineMap = std.StringHashMapUnmanaged(Macro); |
| 20 | const RawTokenList = std.ArrayList(RawToken); | 20 | const RawTokenList = std.array_list.Managed(RawToken); |
| 21 | const max_include_depth = 200; | 21 | const max_include_depth = 200; |
| 22 | 22 | ||
| 23 | /// Errors that can be returned when expanding a macro. | 23 | /// Errors that can be returned when expanding a macro. |
| ... | @@ -84,7 +84,7 @@ tokens: Token.List = .{}, | ... | @@ -84,7 +84,7 @@ tokens: Token.List = .{}, |
| 84 | /// Do not directly mutate this; must be kept in sync with `tokens` | 84 | /// Do not directly mutate this; must be kept in sync with `tokens` |
| 85 | expansion_entries: std.MultiArrayList(ExpansionEntry) = .{}, | 85 | expansion_entries: std.MultiArrayList(ExpansionEntry) = .{}, |
| 86 | token_buf: RawTokenList, | 86 | token_buf: RawTokenList, |
| 87 | char_buf: std.ArrayList(u8), | 87 | char_buf: std.array_list.Managed(u8), |
| 88 | /// Counter that is incremented each time preprocess() is called | 88 | /// Counter that is incremented each time preprocess() is called |
| 89 | /// Can be used to distinguish multiple preprocessings of the same file | 89 | /// Can be used to distinguish multiple preprocessings of the same file |
| 90 | preprocess_count: u32 = 0, | 90 | preprocess_count: u32 = 0, |
| ... | @@ -131,7 +131,7 @@ pub fn init(comp: *Compilation) Preprocessor { | ... | @@ -131,7 +131,7 @@ pub fn init(comp: *Compilation) Preprocessor { |
| 131 | .gpa = comp.gpa, | 131 | .gpa = comp.gpa, |
| 132 | .arena = std.heap.ArenaAllocator.init(comp.gpa), | 132 | .arena = std.heap.ArenaAllocator.init(comp.gpa), |
| 133 | .token_buf = RawTokenList.init(comp.gpa), | 133 | .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), |
| 135 | .poisoned_identifiers = std.StringHashMap(void).init(comp.gpa), | 135 | .poisoned_identifiers = std.StringHashMap(void).init(comp.gpa), |
| 136 | .top_expansion_buf = ExpandBuf.init(comp.gpa), | 136 | .top_expansion_buf = ExpandBuf.init(comp.gpa), |
| 137 | .hideset = .{ .comp = comp }, | 137 | .hideset = .{ .comp = comp }, |
| ... | @@ -982,7 +982,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { | ... | @@ -982,7 +982,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { |
| 982 | .tok_i = @intCast(token_state.tokens_len), | 982 | .tok_i = @intCast(token_state.tokens_len), |
| 983 | .arena = pp.arena.allocator(), | 983 | .arena = pp.arena.allocator(), |
| 984 | .in_macro = true, | 984 | .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), |
| 986 | 986 | ||
| 987 | .data = undefined, | 987 | .data = undefined, |
| 988 | .value_map = undefined, | 988 | .value_map = undefined, |
| ... | @@ -1140,7 +1140,7 @@ fn skipToNl(tokenizer: *Tokenizer) void { | ... | @@ -1140,7 +1140,7 @@ fn skipToNl(tokenizer: *Tokenizer) void { |
| 1140 | } | 1140 | } |
| 1141 | } | 1141 | } |
| 1142 | 1142 | ||
| 1143 | const ExpandBuf = std.ArrayList(TokenWithExpansionLocs); | 1143 | const ExpandBuf = std.array_list.Managed(TokenWithExpansionLocs); |
| 1144 | fn removePlacemarkers(buf: *ExpandBuf) void { | 1144 | fn removePlacemarkers(buf: *ExpandBuf) void { |
| 1145 | var i: usize = buf.items.len -% 1; | 1145 | var i: usize = buf.items.len -% 1; |
| 1146 | while (i < buf.items.len) : (i -%= 1) { | 1146 | while (i < buf.items.len) : (i -%= 1) { |
| ... | @@ -1151,7 +1151,7 @@ fn removePlacemarkers(buf: *ExpandBuf) void { | ... | @@ -1151,7 +1151,7 @@ fn removePlacemarkers(buf: *ExpandBuf) void { |
| 1151 | } | 1151 | } |
| 1152 | } | 1152 | } |
| 1153 | 1153 | ||
| 1154 | const MacroArguments = std.ArrayList([]const TokenWithExpansionLocs); | 1154 | const MacroArguments = std.array_list.Managed([]const TokenWithExpansionLocs); |
| 1155 | fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void { | 1155 | fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void { |
| 1156 | for (args.items) |item| { | 1156 | for (args.items) |item| { |
| 1157 | for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, allocator); | 1157 | for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, allocator); |
| ... | @@ -2075,7 +2075,7 @@ fn collectMacroFuncArguments( | ... | @@ -2075,7 +2075,7 @@ fn collectMacroFuncArguments( |
| 2075 | var parens: u32 = 0; | 2075 | var parens: u32 = 0; |
| 2076 | var args = MacroArguments.init(pp.gpa); | 2076 | var args = MacroArguments.init(pp.gpa); |
| 2077 | errdefer deinitMacroArguments(pp.gpa, &args); | 2077 | 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); |
| 2079 | defer curArgument.deinit(); | 2079 | defer curArgument.deinit(); |
| 2080 | while (true) { | 2080 | while (true) { |
| 2081 | var tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf); | 2081 | 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! | ... | @@ -2645,7 +2645,7 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error! |
| 2645 | /// Handle a function like #define directive. | 2645 | /// Handle a function like #define directive. |
| 2646 | fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macro_name: RawToken, l_paren: RawToken) Error!void { | 2646 | fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macro_name: RawToken, l_paren: RawToken) Error!void { |
| 2647 | assert(macro_name.id.isMacroIdentifier()); | 2647 | 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); |
| 2649 | defer params.deinit(); | 2649 | defer params.deinit(); |
| 2650 | 2650 | ||
| 2651 | // Parse the parameter list. | 2651 | // Parse the parameter list. |
| ... | @@ -3471,7 +3471,7 @@ test "Preserve pragma tokens sometimes" { | ... | @@ -3471,7 +3471,7 @@ test "Preserve pragma tokens sometimes" { |
| 3471 | const allocator = std.testing.allocator; | 3471 | const allocator = std.testing.allocator; |
| 3472 | const Test = struct { | 3472 | const Test = struct { |
| 3473 | fn runPreprocessor(source_text: []const u8) ![]const u8 { | 3473 | 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); |
| 3475 | defer buf.deinit(); | 3475 | defer buf.deinit(); |
| 3476 | 3476 | ||
| 3477 | var comp = Compilation.init(allocator, std.fs.cwd()); | 3477 | var comp = Compilation.init(allocator, std.fs.cwd()); |
| ... | @@ -3602,7 +3602,7 @@ test "Include guards" { | ... | @@ -3602,7 +3602,7 @@ test "Include guards" { |
| 3602 | 3602 | ||
| 3603 | _ = try comp.addSourceFromBuffer(path, "int bar = 5;\n"); | 3603 | _ = try comp.addSourceFromBuffer(path, "int bar = 5;\n"); |
| 3604 | 3604 | ||
| 3605 | var buf = std.ArrayList(u8).init(allocator); | 3605 | var buf = std.array_list.Managed(u8).init(allocator); |
| 3606 | defer buf.deinit(); | 3606 | defer buf.deinit(); |
| 3607 | 3607 | ||
| 3608 | var writer = buf.writer(); | 3608 | 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 { | ... | @@ -157,7 +157,7 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { |
| 157 | return use_linker; | 157 | return use_linker; |
| 158 | } | 158 | } |
| 159 | } else { | 159 | } 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 |
| 161 | defer linker_name.deinit(); | 161 | defer linker_name.deinit(); |
| 162 | if (tc.getTarget().os.tag.isDarwin()) { | 162 | if (tc.getTarget().os.tag.isDarwin()) { |
| 163 | linker_name.appendSliceAssumeCapacity("ld64."); | 163 | linker_name.appendSliceAssumeCapacity("ld64."); |
| ... | @@ -198,7 +198,7 @@ fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8) | ... | @@ -198,7 +198,7 @@ fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8) |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | /// Add toolchain `file_paths` to argv as `-L` arguments | 200 | /// Add toolchain `file_paths` to argv as `-L` arguments |
| 201 | pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | 201 | pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { |
| 202 | try argv.ensureUnusedCapacity(tc.file_paths.items.len); | 202 | try argv.ensureUnusedCapacity(tc.file_paths.items.len); |
| 203 | 203 | ||
| 204 | var bytes_needed: usize = 0; | 204 | var bytes_needed: usize = 0; |
| ... | @@ -332,7 +332,7 @@ pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, des | ... | @@ -332,7 +332,7 @@ pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, des |
| 332 | 332 | ||
| 333 | /// Add linker args to `argv`. Does not add path to linker executable as first item; that must be handled separately | 333 | /// Add linker args to `argv`. Does not add path to linker executable as first item; that must be handled separately |
| 334 | /// Items added to `argv` will be string literals or owned by `tc.arena` so they must not be individually freed | 334 | /// Items added to `argv` will be string literals or owned by `tc.arena` so they must not be individually freed |
| 335 | pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.ArrayList([]const u8)) !void { | 335 | pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.array_list.Managed([]const u8)) !void { |
| 336 | return switch (tc.inner) { | 336 | return switch (tc.inner) { |
| 337 | .uninitialized => unreachable, | 337 | .uninitialized => unreachable, |
| 338 | .linux => |*linux| linux.buildLinkerArgs(tc, argv), | 338 | .linux => |*linux| linux.buildLinkerArgs(tc, argv), |
| ... | @@ -412,7 +412,7 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 { | ... | @@ -412,7 +412,7 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 { |
| 412 | } | 412 | } |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | 415 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { |
| 416 | const unw = try tc.getUnwindLibKind(); | 416 | const unw = try tc.getUnwindLibKind(); |
| 417 | const target = tc.getTarget(); | 417 | const target = tc.getTarget(); |
| 418 | if ((target.abi.isAndroid() and unw == .libgcc) or | 418 | if ((target.abi.isAndroid() and unw == .libgcc) or |
| ... | @@ -450,7 +450,7 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !voi | ... | @@ -450,7 +450,7 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !voi |
| 450 | } | 450 | } |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | 453 | fn addLibGCC(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { |
| 454 | const libgcc_kind = tc.getLibGCCKind(); | 454 | const libgcc_kind = tc.getLibGCCKind(); |
| 455 | if (libgcc_kind == .static or libgcc_kind == .unspecified) { | 455 | if (libgcc_kind == .static or libgcc_kind == .unspecified) { |
| 456 | try argv.append("-lgcc"); | 456 | try argv.append("-lgcc"); |
| ... | @@ -461,7 +461,7 @@ fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | ... | @@ -461,7 +461,7 @@ fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { |
| 461 | } | 461 | } |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | 464 | pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { |
| 465 | const target = tc.getTarget(); | 465 | const target = tc.getTarget(); |
| 466 | const rlt = tc.getRuntimeLibKind(); | 466 | const rlt = tc.getRuntimeLibKind(); |
| 467 | switch (rlt) { | 467 | switch (rlt) { |
lib/compiler/aro/aro/Tree.zig+1-1| ... | @@ -41,7 +41,7 @@ pub const TokenWithExpansionLocs = struct { | ... | @@ -41,7 +41,7 @@ pub const TokenWithExpansionLocs = struct { |
| 41 | 41 | ||
| 42 | pub fn addExpansionLocation(tok: *TokenWithExpansionLocs, gpa: std.mem.Allocator, new: []const Source.Location) !void { | 42 | pub fn addExpansionLocation(tok: *TokenWithExpansionLocs, gpa: std.mem.Allocator, new: []const Source.Location) !void { |
| 43 | if (new.len == 0 or tok.id == .whitespace or tok.id == .macro_ws or tok.id == .placemarker) return; | 43 | 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); |
| 45 | defer { | 45 | defer { |
| 46 | @memset(list.items.ptr[list.items.len..list.capacity], .{}); | 46 | @memset(list.items.ptr[list.items.len..list.capacity], .{}); |
| 47 | // Add a sentinel to indicate the end of the list since | 47 | // 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 { | ... | @@ -162,7 +162,7 @@ pub fn getDefaultLinker(self: *const Linux, target: std.Target) []const u8 { |
| 162 | return "ld"; | 162 | return "ld"; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.ArrayList([]const u8)) Compilation.Error!void { | 165 | pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) Compilation.Error!void { |
| 166 | const d = tc.driver; | 166 | const d = tc.driver; |
| 167 | const target = tc.getTarget(); | 167 | const target = tc.getTarget(); |
| 168 | 168 | ||
| ... | @@ -465,7 +465,7 @@ test Linux { | ... | @@ -465,7 +465,7 @@ test Linux { |
| 465 | 465 | ||
| 466 | try toolchain.discover(); | 466 | try toolchain.discover(); |
| 467 | 467 | ||
| 468 | var argv = std.ArrayList([]const u8).init(driver.comp.gpa); | 468 | var argv = std.array_list.Managed([]const u8).init(driver.comp.gpa); |
| 469 | defer argv.deinit(); | 469 | defer argv.deinit(); |
| 470 | 470 | ||
| 471 | var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined; | 471 | 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) { | ... | @@ -30,7 +30,7 @@ pub const Section = union(enum) { |
| 30 | custom: []const u8, | 30 | custom: []const u8, |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | pub fn getSection(obj: *Object, section: Section) !*std.ArrayList(u8) { | 33 | pub fn getSection(obj: *Object, section: Section) !*std.array_list.Managed(u8) { |
| 34 | switch (obj.format) { | 34 | switch (obj.format) { |
| 35 | .elf => return @as(*Elf, @alignCast(@fieldParentPtr("obj", obj))).getSection(section), | 35 | .elf => return @as(*Elf, @alignCast(@fieldParentPtr("obj", obj))).getSection(section), |
| 36 | else => unreachable, | 36 | else => unreachable, |
lib/compiler/aro/backend/Object/Elf.zig+3-3| ... | @@ -4,7 +4,7 @@ const Target = std.Target; | ... | @@ -4,7 +4,7 @@ const Target = std.Target; |
| 4 | const Object = @import("../Object.zig"); | 4 | const Object = @import("../Object.zig"); |
| 5 | 5 | ||
| 6 | const Section = struct { | 6 | const Section = struct { |
| 7 | data: std.ArrayList(u8), | 7 | data: std.array_list.Managed(u8), |
| 8 | relocations: std.ArrayListUnmanaged(Relocation) = .empty, | 8 | relocations: std.ArrayListUnmanaged(Relocation) = .empty, |
| 9 | flags: u64, | 9 | flags: u64, |
| 10 | type: u32, | 10 | type: u32, |
| ... | @@ -80,12 +80,12 @@ fn sectionString(sec: Object.Section) []const u8 { | ... | @@ -80,12 +80,12 @@ fn sectionString(sec: Object.Section) []const u8 { |
| 80 | }; | 80 | }; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.ArrayList(u8) { | 83 | pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.array_list.Managed(u8) { |
| 84 | const section_name = sectionString(section_kind); | 84 | const section_name = sectionString(section_kind); |
| 85 | const section = elf.sections.get(section_name) orelse blk: { | 85 | const section = elf.sections.get(section_name) orelse blk: { |
| 86 | const section = try elf.arena.allocator().create(Section); | 86 | const section = try elf.arena.allocator().create(Section); |
| 87 | section.* = .{ | 87 | section.* = .{ |
| 88 | .data = std.ArrayList(u8).init(elf.arena.child_allocator), | 88 | .data = std.array_list.Managed(u8).init(elf.arena.child_allocator), |
| 89 | .type = std.elf.SHT_PROGBITS, | 89 | .type = std.elf.SHT_PROGBITS, |
| 90 | .flags = switch (section_kind) { | 90 | .flags = switch (section_kind) { |
| 91 | .func, .custom => std.elf.SHF_ALLOC + std.elf.SHF_EXECINSTR, | 91 | .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( | ... | @@ -116,7 +116,7 @@ pub fn translate( |
| 116 | var driver: aro.Driver = .{ .comp = comp }; | 116 | var driver: aro.Driver = .{ .comp = comp }; |
| 117 | defer driver.deinit(); | 117 | defer driver.deinit(); |
| 118 | 118 | ||
| 119 | var macro_buf = std.ArrayList(u8).init(gpa); | 119 | var macro_buf = std.array_list.Managed(u8).init(gpa); |
| 120 | defer macro_buf.deinit(); | 120 | defer macro_buf.deinit(); |
| 121 | 121 | ||
| 122 | assert(!try driver.parseArgs(std.io.null_writer, macro_buf.writer(), args)); | 122 | 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 { | ... | @@ -413,11 +413,11 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_ty: Type) Error!void { |
| 413 | break :blk ZigTag.opaque_literal.init(); | 413 | break :blk ZigTag.opaque_literal.init(); |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 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); |
| 417 | defer fields.deinit(); | 417 | defer fields.deinit(); |
| 418 | 418 | ||
| 419 | // TODO: Add support for flexible array field functions | 419 | // 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); |
| 421 | defer functions.deinit(); | 421 | defer functions.deinit(); |
| 422 | 422 | ||
| 423 | var unnamed_field_count: u32 = 0; | 423 | var unnamed_field_count: u32 = 0; |
| ... | @@ -1234,7 +1234,7 @@ pub const PatternList = struct { | ... | @@ -1234,7 +1234,7 @@ pub const PatternList = struct { |
| 1234 | const source = template[0]; | 1234 | const source = template[0]; |
| 1235 | const impl = template[1]; | 1235 | const impl = template[1]; |
| 1236 | 1236 | ||
| 1237 | var tok_list = std.ArrayList(CToken).init(allocator); | 1237 | var tok_list = std.array_list.Managed(CToken).init(allocator); |
| 1238 | defer tok_list.deinit(); | 1238 | defer tok_list.deinit(); |
| 1239 | try tokenizeMacro(source, &tok_list); | 1239 | try tokenizeMacro(source, &tok_list); |
| 1240 | const tokens = try allocator.dupe(CToken, tok_list.items); | 1240 | const tokens = try allocator.dupe(CToken, tok_list.items); |
| ... | @@ -1349,7 +1349,7 @@ pub const TypeError = Error || error{UnsupportedType}; | ... | @@ -1349,7 +1349,7 @@ pub const TypeError = Error || error{UnsupportedType}; |
| 1349 | pub const TransError = TypeError || error{UnsupportedTranslation}; | 1349 | pub const TransError = TypeError || error{UnsupportedTranslation}; |
| 1350 | 1350 | ||
| 1351 | pub const SymbolTable = std.StringArrayHashMap(ast.Node); | 1351 | pub const SymbolTable = std.StringArrayHashMap(ast.Node); |
| 1352 | pub const AliasList = std.ArrayList(struct { | 1352 | pub const AliasList = std.array_list.Managed(struct { |
| 1353 | alias: []const u8, | 1353 | alias: []const u8, |
| 1354 | name: []const u8, | 1354 | name: []const u8, |
| 1355 | }); | 1355 | }); |
| ... | @@ -1397,7 +1397,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1397,7 +1397,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1397 | /// into the main arena. | 1397 | /// into the main arena. |
| 1398 | pub const Block = struct { | 1398 | pub const Block = struct { |
| 1399 | base: ScopeExtraScope, | 1399 | base: ScopeExtraScope, |
| 1400 | statements: std.ArrayList(ast.Node), | 1400 | statements: std.array_list.Managed(ast.Node), |
| 1401 | variables: AliasList, | 1401 | variables: AliasList, |
| 1402 | mangle_count: u32 = 0, | 1402 | mangle_count: u32 = 0, |
| 1403 | label: ?[]const u8 = null, | 1403 | label: ?[]const u8 = null, |
| ... | @@ -1429,7 +1429,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1429,7 +1429,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1429 | .id = .block, | 1429 | .id = .block, |
| 1430 | .parent = parent, | 1430 | .parent = parent, |
| 1431 | }, | 1431 | }, |
| 1432 | .statements = std.ArrayList(ast.Node).init(c.gpa), | 1432 | .statements = std.array_list.Managed(ast.Node).init(c.gpa), |
| 1433 | .variables = AliasList.init(c.gpa), | 1433 | .variables = AliasList.init(c.gpa), |
| 1434 | .variable_discards = std.StringArrayHashMap(*ast.Payload.Discard).init(c.gpa), | 1434 | .variable_discards = std.StringArrayHashMap(*ast.Payload.Discard).init(c.gpa), |
| 1435 | }; | 1435 | }; |
| ... | @@ -1557,7 +1557,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1557,7 +1557,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1557 | sym_table: SymbolTable, | 1557 | sym_table: SymbolTable, |
| 1558 | blank_macros: std.StringArrayHashMap(void), | 1558 | blank_macros: std.StringArrayHashMap(void), |
| 1559 | context: *ScopeExtraContext, | 1559 | context: *ScopeExtraContext, |
| 1560 | nodes: std.ArrayList(ast.Node), | 1560 | nodes: std.array_list.Managed(ast.Node), |
| 1561 | 1561 | ||
| 1562 | pub fn init(c: *ScopeExtraContext) Root { | 1562 | pub fn init(c: *ScopeExtraContext) Root { |
| 1563 | return .{ | 1563 | return .{ |
| ... | @@ -1568,7 +1568,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1568,7 +1568,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1568 | .sym_table = SymbolTable.init(c.gpa), | 1568 | .sym_table = SymbolTable.init(c.gpa), |
| 1569 | .blank_macros = std.StringArrayHashMap(void).init(c.gpa), | 1569 | .blank_macros = std.StringArrayHashMap(void).init(c.gpa), |
| 1570 | .context = c, | 1570 | .context = c, |
| 1571 | .nodes = std.ArrayList(ast.Node).init(c.gpa), | 1571 | .nodes = std.array_list.Managed(ast.Node).init(c.gpa), |
| 1572 | }; | 1572 | }; |
| 1573 | } | 1573 | } |
| 1574 | 1574 | ||
| ... | @@ -1705,7 +1705,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1705,7 +1705,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1705 | }; | 1705 | }; |
| 1706 | } | 1706 | } |
| 1707 | 1707 | ||
| 1708 | pub fn tokenizeMacro(source: []const u8, tok_list: *std.ArrayList(CToken)) Error!void { | 1708 | pub fn tokenizeMacro(source: []const u8, tok_list: *std.array_list.Managed(CToken)) Error!void { |
| 1709 | var tokenizer: aro.Tokenizer = .{ | 1709 | var tokenizer: aro.Tokenizer = .{ |
| 1710 | .buf = source, | 1710 | .buf = source, |
| 1711 | .source = .unused, | 1711 | .source = .unused, |
| ... | @@ -1732,7 +1732,7 @@ test "Macro matching" { | ... | @@ -1732,7 +1732,7 @@ test "Macro matching" { |
| 1732 | const helper = struct { | 1732 | const helper = struct { |
| 1733 | const MacroFunctions = std.zig.c_translation.Macros; | 1733 | const MacroFunctions = std.zig.c_translation.Macros; |
| 1734 | fn checkMacro(allocator: mem.Allocator, pattern_list: PatternList, source: []const u8, comptime expected_match: ?[]const u8) !void { | 1734 | 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); |
| 1736 | defer tok_list.deinit(); | 1736 | defer tok_list.deinit(); |
| 1737 | try tokenizeMacro(source, &tok_list); | 1737 | try tokenizeMacro(source, &tok_list); |
| 1738 | const macro_slicer: MacroSlicer = .{ .source = source, .tokens = tok_list.items }; | 1738 | 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 { | ... | @@ -763,7 +763,7 @@ pub const Payload = struct { |
| 763 | pub fn render(gpa: Allocator, nodes: []const Node) !std.zig.Ast { | 763 | pub fn render(gpa: Allocator, nodes: []const Node) !std.zig.Ast { |
| 764 | var ctx = Context{ | 764 | var ctx = Context{ |
| 765 | .gpa = gpa, | 765 | .gpa = gpa, |
| 766 | .buf = std.ArrayList(u8).init(gpa), | 766 | .buf = std.array_list.Managed(u8).init(gpa), |
| 767 | }; | 767 | }; |
| 768 | defer ctx.buf.deinit(); | 768 | defer ctx.buf.deinit(); |
| 769 | defer ctx.nodes.deinit(gpa); | 769 | defer ctx.nodes.deinit(gpa); |
| ... | @@ -787,7 +787,7 @@ pub fn render(gpa: Allocator, nodes: []const Node) !std.zig.Ast { | ... | @@ -787,7 +787,7 @@ pub fn render(gpa: Allocator, nodes: []const Node) !std.zig.Ast { |
| 787 | }); | 787 | }); |
| 788 | 788 | ||
| 789 | const root_members = blk: { | 789 | const root_members = blk: { |
| 790 | var result = std.ArrayList(NodeIndex).init(gpa); | 790 | var result = std.array_list.Managed(NodeIndex).init(gpa); |
| 791 | defer result.deinit(); | 791 | defer result.deinit(); |
| 792 | 792 | ||
| 793 | for (nodes) |node| { | 793 | for (nodes) |node| { |
| ... | @@ -825,7 +825,7 @@ const ExtraIndex = std.zig.Ast.ExtraIndex; | ... | @@ -825,7 +825,7 @@ const ExtraIndex = std.zig.Ast.ExtraIndex; |
| 825 | 825 | ||
| 826 | const Context = struct { | 826 | const Context = struct { |
| 827 | gpa: Allocator, | 827 | gpa: Allocator, |
| 828 | buf: std.ArrayList(u8), | 828 | buf: std.array_list.Managed(u8), |
| 829 | nodes: std.zig.Ast.NodeList = .{}, | 829 | nodes: std.zig.Ast.NodeList = .{}, |
| 830 | extra_data: std.ArrayListUnmanaged(u32) = .empty, | 830 | extra_data: std.ArrayListUnmanaged(u32) = .empty, |
| 831 | tokens: std.zig.Ast.TokenList = .{}, | 831 | tokens: std.zig.Ast.TokenList = .{}, |
| ... | @@ -886,7 +886,7 @@ const Context = struct { | ... | @@ -886,7 +886,7 @@ const Context = struct { |
| 886 | }; | 886 | }; |
| 887 | 887 | ||
| 888 | fn renderNodes(c: *Context, nodes: []const Node) Allocator.Error!NodeSubRange { | 888 | fn 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); |
| 890 | defer result.deinit(); | 890 | defer result.deinit(); |
| 891 | 891 | ||
| 892 | for (nodes) |node| { | 892 | for (nodes) |node| { |
| ... | @@ -1622,7 +1622,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { | ... | @@ -1622,7 +1622,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { |
| 1622 | } | 1622 | } |
| 1623 | const l_brace = try c.addToken(.l_brace, "{"); | 1623 | const l_brace = try c.addToken(.l_brace, "{"); |
| 1624 | 1624 | ||
| 1625 | var stmts = std.ArrayList(NodeIndex).init(c.gpa); | 1625 | var stmts = std.array_list.Managed(NodeIndex).init(c.gpa); |
| 1626 | defer stmts.deinit(); | 1626 | defer stmts.deinit(); |
| 1627 | for (payload.stmts) |stmt| { | 1627 | for (payload.stmts) |stmt| { |
| 1628 | const res = try renderNode(c, stmt); | 1628 | const res = try renderNode(c, stmt); |
| ... | @@ -2954,9 +2954,9 @@ fn renderMacroFunc(c: *Context, node: Node) !NodeIndex { | ... | @@ -2954,9 +2954,9 @@ fn renderMacroFunc(c: *Context, node: Node) !NodeIndex { |
| 2954 | }); | 2954 | }); |
| 2955 | } | 2955 | } |
| 2956 | 2956 | ||
| 2957 | fn renderParams(c: *Context, params: []Payload.Param, is_var_args: bool) !std.ArrayList(NodeIndex) { | 2957 | fn renderParams(c: *Context, params: []Payload.Param, is_var_args: bool) !std.array_list.Managed(NodeIndex) { |
| 2958 | _ = try c.addToken(.l_paren, "("); | 2958 | _ = 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); |
| 2960 | errdefer rendered.deinit(); | 2960 | errdefer rendered.deinit(); |
| 2961 | 2961 | ||
| 2962 | for (params, 0..) |param, i| { | 2962 | for (params, 0..) |param, i| { |
lib/compiler/build_runner.zig+2-3| ... | @@ -5,7 +5,6 @@ const io = std.io; | ... | @@ -5,7 +5,6 @@ const io = std.io; |
| 5 | const fmt = std.fmt; | 5 | const fmt = std.fmt; |
| 6 | const mem = std.mem; | 6 | const mem = std.mem; |
| 7 | const process = std.process; | 7 | const process = std.process; |
| 8 | const ArrayList = std.ArrayList; | ||
| 9 | const File = std.fs.File; | 8 | const File = std.fs.File; |
| 10 | const Step = std.Build.Step; | 9 | const Step = std.Build.Step; |
| 11 | const Watch = std.Build.Watch; | 10 | const Watch = std.Build.Watch; |
| ... | @@ -98,8 +97,8 @@ pub fn main() !void { | ... | @@ -98,8 +97,8 @@ pub fn main() !void { |
| 98 | dependencies.root_deps, | 97 | dependencies.root_deps, |
| 99 | ); | 98 | ); |
| 100 | 99 | ||
| 101 | var targets = ArrayList([]const u8).init(arena); | 100 | var targets = std.array_list.Managed([]const u8).init(arena); |
| 102 | var debug_log_scopes = ArrayList([]const u8).init(arena); | 101 | var debug_log_scopes = std.array_list.Managed([]const u8).init(arena); |
| 103 | var thread_pool_options: std.Thread.Pool.Options = .{ .allocator = arena }; | 102 | var thread_pool_options: std.Thread.Pool.Options = .{ .allocator = arena }; |
| 104 | 103 | ||
| 105 | var install_prefix: ?[]const u8 = null; | 104 | var install_prefix: ?[]const u8 = null; |
lib/compiler/reduce.zig+4-4| ... | @@ -114,10 +114,10 @@ pub fn main() !void { | ... | @@ -114,10 +114,10 @@ pub fn main() !void { |
| 114 | interestingness_argv.appendAssumeCapacity(checker_path); | 114 | interestingness_argv.appendAssumeCapacity(checker_path); |
| 115 | interestingness_argv.appendSliceAssumeCapacity(argv); | 115 | interestingness_argv.appendSliceAssumeCapacity(argv); |
| 116 | 116 | ||
| 117 | var rendered = std.ArrayList(u8).init(gpa); | 117 | var rendered = std.array_list.Managed(u8).init(gpa); |
| 118 | defer rendered.deinit(); | 118 | defer rendered.deinit(); |
| 119 | 119 | ||
| 120 | var astgen_input = std.ArrayList(u8).init(gpa); | 120 | var astgen_input = std.array_list.Managed(u8).init(gpa); |
| 121 | defer astgen_input.deinit(); | 121 | defer astgen_input.deinit(); |
| 122 | 122 | ||
| 123 | var tree = try parse(gpa, root_source_file_path); | 123 | var tree = try parse(gpa, root_source_file_path); |
| ... | @@ -161,7 +161,7 @@ pub fn main() !void { | ... | @@ -161,7 +161,7 @@ pub fn main() !void { |
| 161 | // result, restart the whole process, reparsing the AST and re-generating the list | 161 | // result, restart the whole process, reparsing the AST and re-generating the list |
| 162 | // of all possible transformations and shuffling it again. | 162 | // of all possible transformations and shuffling it again. |
| 163 | 163 | ||
| 164 | var transformations = std.ArrayList(Walk.Transformation).init(gpa); | 164 | var transformations = std.array_list.Managed(Walk.Transformation).init(gpa); |
| 165 | defer transformations.deinit(); | 165 | defer transformations.deinit(); |
| 166 | try Walk.findTransformations(arena, &tree, &transformations); | 166 | try Walk.findTransformations(arena, &tree, &transformations); |
| 167 | sortTransformations(transformations.items, rng.random()); | 167 | sortTransformations(transformations.items, rng.random()); |
| ... | @@ -382,7 +382,7 @@ fn transformationsToFixups( | ... | @@ -382,7 +382,7 @@ fn transformationsToFixups( |
| 382 | } | 382 | } |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | var other_source = std.ArrayList(u8).init(gpa); | 385 | var other_source = std.array_list.Managed(u8).init(gpa); |
| 386 | defer other_source.deinit(); | 386 | defer other_source.deinit(); |
| 387 | try other_source.appendSlice("struct {\n"); | 387 | try other_source.appendSlice("struct {\n"); |
| 388 | try other_file_ast.renderToArrayList(&other_source, inlined_fixups); | 388 | 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; | ... | @@ -5,7 +5,7 @@ const assert = std.debug.assert; |
| 5 | const BuiltinFn = std.zig.BuiltinFn; | 5 | const BuiltinFn = std.zig.BuiltinFn; |
| 6 | 6 | ||
| 7 | ast: *const Ast, | 7 | ast: *const Ast, |
| 8 | transformations: *std.ArrayList(Transformation), | 8 | transformations: *std.array_list.Managed(Transformation), |
| 9 | unreferenced_globals: std.StringArrayHashMapUnmanaged(Ast.Node.Index), | 9 | unreferenced_globals: std.StringArrayHashMapUnmanaged(Ast.Node.Index), |
| 10 | in_scope_names: std.StringArrayHashMapUnmanaged(u32), | 10 | in_scope_names: std.StringArrayHashMapUnmanaged(u32), |
| 11 | replace_names: std.StringArrayHashMapUnmanaged(u32), | 11 | replace_names: std.StringArrayHashMapUnmanaged(u32), |
| ... | @@ -54,7 +54,7 @@ pub const Error = error{OutOfMemory}; | ... | @@ -54,7 +54,7 @@ pub const Error = error{OutOfMemory}; |
| 54 | pub fn findTransformations( | 54 | pub fn findTransformations( |
| 55 | arena: std.mem.Allocator, | 55 | arena: std.mem.Allocator, |
| 56 | ast: *const Ast, | 56 | ast: *const Ast, |
| 57 | transformations: *std.ArrayList(Transformation), | 57 | transformations: *std.array_list.Managed(Transformation), |
| 58 | ) !void { | 58 | ) !void { |
| 59 | transformations.clearRetainingCapacity(); | 59 | transformations.clearRetainingCapacity(); |
| 60 | 60 |
lib/compiler/resinator/cli.zig+1-1| ... | @@ -1291,7 +1291,7 @@ pub fn parse(allocator: Allocator, args: []const []const u8, diagnostics: *Diagn | ... | @@ -1291,7 +1291,7 @@ pub fn parse(allocator: Allocator, args: []const []const u8, diagnostics: *Diagn |
| 1291 | } | 1291 | } |
| 1292 | 1292 | ||
| 1293 | pub fn filepathWithExtension(allocator: Allocator, path: []const u8, ext: []const u8) ![]const u8 { | 1293 | pub 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); |
| 1295 | errdefer buf.deinit(); | 1295 | errdefer buf.deinit(); |
| 1296 | if (std.fs.path.dirname(path)) |dirname| { | 1296 | if (std.fs.path.dirname(path)) |dirname| { |
| 1297 | var end_pos = dirname.len; | 1297 | var end_pos = dirname.len; |
lib/compiler/resinator/compile.zig+15-15| ... | @@ -38,7 +38,7 @@ pub const CompileOptions = struct { | ... | @@ -38,7 +38,7 @@ pub const CompileOptions = struct { |
| 38 | /// Items within the list will be allocated using the allocator of the ArrayList and must be | 38 | /// Items within the list will be allocated using the allocator of the ArrayList and must be |
| 39 | /// freed by the caller. | 39 | /// freed by the caller. |
| 40 | /// TODO: Maybe a dedicated struct for this purpose so that it's a bit nicer to work with. | 40 | /// 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, |
| 42 | default_code_page: SupportedCodePage = .windows1252, | 42 | default_code_page: SupportedCodePage = .windows1252, |
| 43 | /// If true, the first #pragma code_page directive only sets the input code page, but not the output code page. | 43 | /// If true, the first #pragma code_page directive only sets the input code page, but not the output code page. |
| 44 | /// This check must be done before comments are removed from the file. | 44 | /// 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 | ... | @@ -74,7 +74,7 @@ pub fn compile(allocator: Allocator, source: []const u8, writer: anytype, option |
| 74 | var tree = try parser.parse(allocator, options.diagnostics); | 74 | var tree = try parser.parse(allocator, options.diagnostics); |
| 75 | defer tree.deinit(); | 75 | defer tree.deinit(); |
| 76 | 76 | ||
| 77 | var search_dirs = std.ArrayList(SearchDir).init(allocator); | 77 | var search_dirs = std.array_list.Managed(SearchDir).init(allocator); |
| 78 | defer { | 78 | defer { |
| 79 | for (search_dirs.items) |*search_dir| { | 79 | for (search_dirs.items) |*search_dir| { |
| 80 | search_dir.deinit(allocator); | 80 | search_dir.deinit(allocator); |
| ... | @@ -178,7 +178,7 @@ pub const Compiler = struct { | ... | @@ -178,7 +178,7 @@ pub const Compiler = struct { |
| 178 | cwd: std.fs.Dir, | 178 | cwd: std.fs.Dir, |
| 179 | state: State = .{}, | 179 | state: State = .{}, |
| 180 | diagnostics: *Diagnostics, | 180 | diagnostics: *Diagnostics, |
| 181 | dependencies_list: ?*std.ArrayList([]const u8), | 181 | dependencies_list: ?*std.array_list.Managed([]const u8), |
| 182 | input_code_pages: *const CodePageLookup, | 182 | input_code_pages: *const CodePageLookup, |
| 183 | output_code_pages: *const CodePageLookup, | 183 | output_code_pages: *const CodePageLookup, |
| 184 | search_dirs: []SearchDir, | 184 | search_dirs: []SearchDir, |
| ... | @@ -279,7 +279,7 @@ pub const Compiler = struct { | ... | @@ -279,7 +279,7 @@ pub const Compiler = struct { |
| 279 | .literal, .number => { | 279 | .literal, .number => { |
| 280 | const slice = literal_node.token.slice(self.source); | 280 | const slice = literal_node.token.slice(self.source); |
| 281 | const code_page = self.input_code_pages.getForToken(literal_node.token); | 281 | 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); |
| 283 | errdefer buf.deinit(); | 283 | errdefer buf.deinit(); |
| 284 | 284 | ||
| 285 | var index: usize = 0; | 285 | var index: usize = 0; |
| ... | @@ -303,7 +303,7 @@ pub const Compiler = struct { | ... | @@ -303,7 +303,7 @@ pub const Compiler = struct { |
| 303 | const column = literal_node.token.calculateColumn(self.source, 8, null); | 303 | const column = literal_node.token.calculateColumn(self.source, 8, null); |
| 304 | const bytes = SourceBytes{ .slice = slice, .code_page = self.input_code_pages.getForToken(literal_node.token) }; | 304 | const bytes = SourceBytes{ .slice = slice, .code_page = self.input_code_pages.getForToken(literal_node.token) }; |
| 305 | 305 | ||
| 306 | var buf = std.ArrayList(u8).init(self.allocator); | 306 | var buf = std.array_list.Managed(u8).init(self.allocator); |
| 307 | errdefer buf.deinit(); | 307 | errdefer buf.deinit(); |
| 308 | 308 | ||
| 309 | // Filenames are sort-of parsed as if they were wide strings, but the max escape width of | 309 | // 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 { | ... | @@ -421,7 +421,7 @@ pub const Compiler = struct { |
| 421 | const bytes = self.sourceBytesForToken(token); | 421 | const bytes = self.sourceBytesForToken(token); |
| 422 | const output_code_page = self.output_code_pages.getForToken(token); | 422 | const output_code_page = self.output_code_pages.getForToken(token); |
| 423 | 423 | ||
| 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); |
| 425 | errdefer buf.deinit(); | 425 | errdefer buf.deinit(); |
| 426 | 426 | ||
| 427 | var iterative_parser = literals.IterativeStringParser.init(bytes, .{ | 427 | var iterative_parser = literals.IterativeStringParser.init(bytes, .{ |
| ... | @@ -1226,7 +1226,7 @@ pub const Compiler = struct { | ... | @@ -1226,7 +1226,7 @@ pub const Compiler = struct { |
| 1226 | } | 1226 | } |
| 1227 | 1227 | ||
| 1228 | pub fn writeResourceRawData(self: *Compiler, node: *Node.ResourceRawData, writer: anytype) !void { | 1228 | 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); |
| 1230 | defer data_buffer.deinit(); | 1230 | defer data_buffer.deinit(); |
| 1231 | // The header's data length field is a u32 so limit the resource's data size so that | 1231 | // The header's data length field is a u32 so limit the resource's data size so that |
| 1232 | // we know we can always specify the real size. | 1232 | // we know we can always specify the real size. |
| ... | @@ -1306,7 +1306,7 @@ pub const Compiler = struct { | ... | @@ -1306,7 +1306,7 @@ pub const Compiler = struct { |
| 1306 | } | 1306 | } |
| 1307 | 1307 | ||
| 1308 | pub fn writeAccelerators(self: *Compiler, node: *Node.Accelerators, writer: anytype) !void { | 1308 | 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); |
| 1310 | defer data_buffer.deinit(); | 1310 | defer data_buffer.deinit(); |
| 1311 | 1311 | ||
| 1312 | // The header's data length field is a u32 so limit the resource's data size so that | 1312 | // 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 { | ... | @@ -1405,7 +1405,7 @@ pub const Compiler = struct { |
| 1405 | }; | 1405 | }; |
| 1406 | 1406 | ||
| 1407 | pub fn writeDialog(self: *Compiler, node: *Node.Dialog, writer: anytype) !void { | 1407 | 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); |
| 1409 | defer data_buffer.deinit(); | 1409 | defer data_buffer.deinit(); |
| 1410 | // The header's data length field is a u32 so limit the resource's data size so that | 1410 | // The header's data length field is a u32 so limit the resource's data size so that |
| 1411 | // we know we can always specify the real size. | 1411 | // we know we can always specify the real size. |
| ... | @@ -1973,7 +1973,7 @@ pub const Compiler = struct { | ... | @@ -1973,7 +1973,7 @@ pub const Compiler = struct { |
| 1973 | try NameOrOrdinal.writeEmpty(data_writer); | 1973 | try NameOrOrdinal.writeEmpty(data_writer); |
| 1974 | } | 1974 | } |
| 1975 | 1975 | ||
| 1976 | var extra_data_buf = std.ArrayList(u8).init(self.allocator); | 1976 | var extra_data_buf = std.array_list.Managed(u8).init(self.allocator); |
| 1977 | defer extra_data_buf.deinit(); | 1977 | defer extra_data_buf.deinit(); |
| 1978 | // The extra data byte length must be able to fit within a u16. | 1978 | // The extra data byte length must be able to fit within a u16. |
| 1979 | var limited_extra_data_writer = limitedWriter(extra_data_buf.writer(), std.math.maxInt(u16)); | 1979 | var limited_extra_data_writer = limitedWriter(extra_data_buf.writer(), std.math.maxInt(u16)); |
| ... | @@ -2004,7 +2004,7 @@ pub const Compiler = struct { | ... | @@ -2004,7 +2004,7 @@ pub const Compiler = struct { |
| 2004 | } | 2004 | } |
| 2005 | 2005 | ||
| 2006 | pub fn writeToolbar(self: *Compiler, node: *Node.Toolbar, writer: anytype) !void { | 2006 | 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); |
| 2008 | defer data_buffer.deinit(); | 2008 | defer data_buffer.deinit(); |
| 2009 | const data_writer = data_buffer.writer(); | 2009 | const data_writer = data_buffer.writer(); |
| 2010 | 2010 | ||
| ... | @@ -2082,7 +2082,7 @@ pub const Compiler = struct { | ... | @@ -2082,7 +2082,7 @@ pub const Compiler = struct { |
| 2082 | } | 2082 | } |
| 2083 | 2083 | ||
| 2084 | pub fn writeMenu(self: *Compiler, node: *Node.Menu, writer: anytype) !void { | 2084 | 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); |
| 2086 | defer data_buffer.deinit(); | 2086 | defer data_buffer.deinit(); |
| 2087 | // The header's data length field is a u32 so limit the resource's data size so that | 2087 | // The header's data length field is a u32 so limit the resource's data size so that |
| 2088 | // we know we can always specify the real size. | 2088 | // we know we can always specify the real size. |
| ... | @@ -2265,7 +2265,7 @@ pub const Compiler = struct { | ... | @@ -2265,7 +2265,7 @@ pub const Compiler = struct { |
| 2265 | } | 2265 | } |
| 2266 | 2266 | ||
| 2267 | pub fn writeVersionInfo(self: *Compiler, node: *Node.VersionInfo, writer: anytype) !void { | 2267 | 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); |
| 2269 | defer data_buffer.deinit(); | 2269 | defer data_buffer.deinit(); |
| 2270 | // The node's length field (which is inclusive of the length of all of its children) is a u16 | 2270 | // The node's length field (which is inclusive of the length of all of its children) is a u16 |
| 2271 | // so limit the node's data size so that we know we can always specify the real size. | 2271 | // 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 { | ... | @@ -2394,7 +2394,7 @@ pub const Compiler = struct { |
| 2394 | /// Expects writer to be a LimitedWriter limited to u16, meaning all writes to | 2394 | /// Expects writer to be a LimitedWriter limited to u16, meaning all writes to |
| 2395 | /// the writer within this function could return error.NoSpaceLeft, and that buf.items.len | 2395 | /// the writer within this function could return error.NoSpaceLeft, and that buf.items.len |
| 2396 | /// will never be able to exceed maxInt(u16). | 2396 | /// 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 { |
| 2398 | // We can assume that buf.items.len will never be able to exceed the limits of a u16 | 2398 | // We can assume that buf.items.len will never be able to exceed the limits of a u16 |
| 2399 | try writeDataPadding(writer, @as(u16, @intCast(buf.items.len))); | 2399 | try writeDataPadding(writer, @as(u16, @intCast(buf.items.len))); |
| 2400 | 2400 | ||
| ... | @@ -3246,7 +3246,7 @@ pub const StringTable = struct { | ... | @@ -3246,7 +3246,7 @@ pub const StringTable = struct { |
| 3246 | } | 3246 | } |
| 3247 | 3247 | ||
| 3248 | pub fn writeResData(self: *Block, compiler: *Compiler, language: res.Language, block_id: u16, writer: anytype) !void { | 3248 | 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); |
| 3250 | defer data_buffer.deinit(); | 3250 | defer data_buffer.deinit(); |
| 3251 | const data_writer = data_buffer.writer(); | 3251 | const data_writer = data_buffer.writer(); |
| 3252 | 3252 |
lib/compiler/resinator/ico.zig+1-1| ... | @@ -56,7 +56,7 @@ pub fn readAnyError(allocator: std.mem.Allocator, reader: anytype, max_size: u64 | ... | @@ -56,7 +56,7 @@ pub fn readAnyError(allocator: std.mem.Allocator, reader: anytype, max_size: u64 |
| 56 | // entries than it actually does, we use an ArrayList with a conservatively | 56 | // entries than it actually does, we use an ArrayList with a conservatively |
| 57 | // limited initial capacity instead of allocating the entire slice at once. | 57 | // limited initial capacity instead of allocating the entire slice at once. |
| 58 | const initial_capacity = @min(num_images, 8); | 58 | 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); |
| 60 | errdefer entries.deinit(); | 60 | errdefer entries.deinit(); |
| 61 | 61 | ||
| 62 | var i: usize = 0; | 62 | var i: usize = 0; |
lib/compiler/resinator/literals.zig+2-2| ... | @@ -469,7 +469,7 @@ pub fn parseQuotedString( | ... | @@ -469,7 +469,7 @@ pub fn parseQuotedString( |
| 469 | const T = if (literal_type == .ascii) u8 else u16; | 469 | const T = if (literal_type == .ascii) u8 else u16; |
| 470 | std.debug.assert(bytes.slice.len >= 2); // must at least have 2 double quote chars | 470 | std.debug.assert(bytes.slice.len >= 2); // must at least have 2 double quote chars |
| 471 | 471 | ||
| 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); |
| 473 | errdefer buf.deinit(); | 473 | errdefer buf.deinit(); |
| 474 | 474 | ||
| 475 | var iterative_parser = IterativeStringParser.init(bytes, options); | 475 | var iterative_parser = IterativeStringParser.init(bytes, options); |
| ... | @@ -564,7 +564,7 @@ pub fn parseQuotedStringAsWideString(allocator: std.mem.Allocator, bytes: Source | ... | @@ -564,7 +564,7 @@ pub fn parseQuotedStringAsWideString(allocator: std.mem.Allocator, bytes: Source |
| 564 | // Note: We're only handling the case of parsing an ASCII string into a wide string from here on out. | 564 | // Note: We're only handling the case of parsing an ASCII string into a wide string from here on out. |
| 565 | // TODO: The logic below is similar to that in AcceleratorKeyCodepointTranslator, might be worth merging the two | 565 | // TODO: The logic below is similar to that in AcceleratorKeyCodepointTranslator, might be worth merging the two |
| 566 | 566 | ||
| 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); |
| 568 | errdefer buf.deinit(); | 568 | errdefer buf.deinit(); |
| 569 | 569 | ||
| 570 | var iterative_parser = IterativeStringParser.init(bytes, options); | 570 | var iterative_parser = IterativeStringParser.init(bytes, options); |
lib/compiler/resinator/main.zig+6-6| ... | @@ -97,14 +97,14 @@ pub fn main() !void { | ... | @@ -97,14 +97,14 @@ pub fn main() !void { |
| 97 | try stdout_writer.writeByte('\n'); | 97 | try stdout_writer.writeByte('\n'); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | var dependencies_list = std.ArrayList([]const u8).init(allocator); | 100 | var dependencies_list = std.array_list.Managed([]const u8).init(allocator); |
| 101 | defer { | 101 | defer { |
| 102 | for (dependencies_list.items) |item| { | 102 | for (dependencies_list.items) |item| { |
| 103 | allocator.free(item); | 103 | allocator.free(item); |
| 104 | } | 104 | } |
| 105 | dependencies_list.deinit(); | 105 | dependencies_list.deinit(); |
| 106 | } | 106 | } |
| 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; |
| 108 | 108 | ||
| 109 | var include_paths = LazyIncludePaths{ | 109 | var include_paths = LazyIncludePaths{ |
| 110 | .arena = arena, | 110 | .arena = arena, |
| ... | @@ -115,7 +115,7 @@ pub fn main() !void { | ... | @@ -115,7 +115,7 @@ pub fn main() !void { |
| 115 | 115 | ||
| 116 | const full_input = full_input: { | 116 | const full_input = full_input: { |
| 117 | if (options.input_format == .rc and options.preprocess != .no) { | 117 | 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); |
| 119 | errdefer preprocessed_buf.deinit(); | 119 | errdefer preprocessed_buf.deinit(); |
| 120 | 120 | ||
| 121 | // We're going to throw away everything except the final preprocessed output anyway, | 121 | // We're going to throw away everything except the final preprocessed output anyway, |
| ... | @@ -127,7 +127,7 @@ pub fn main() !void { | ... | @@ -127,7 +127,7 @@ pub fn main() !void { |
| 127 | var comp = aro.Compilation.init(aro_arena, std.fs.cwd()); | 127 | var comp = aro.Compilation.init(aro_arena, std.fs.cwd()); |
| 128 | defer comp.deinit(); | 128 | defer comp.deinit(); |
| 129 | 129 | ||
| 130 | var argv = std.ArrayList([]const u8).init(comp.gpa); | 130 | var argv = std.array_list.Managed([]const u8).init(comp.gpa); |
| 131 | defer argv.deinit(); | 131 | defer argv.deinit(); |
| 132 | 132 | ||
| 133 | try argv.append("arocc"); // dummy command name | 133 | try argv.append("arocc"); // dummy command name |
| ... | @@ -946,7 +946,7 @@ fn aroDiagnosticsToErrorBundle( | ... | @@ -946,7 +946,7 @@ fn aroDiagnosticsToErrorBundle( |
| 946 | // - Only prints the message itself (no location, source line, error: prefix, etc) | 946 | // - Only prints the message itself (no location, source line, error: prefix, etc) |
| 947 | // - Keeps track of source path/line/col instead | 947 | // - Keeps track of source path/line/col instead |
| 948 | const MsgWriter = struct { | 948 | const MsgWriter = struct { |
| 949 | buf: std.ArrayList(u8), | 949 | buf: std.array_list.Managed(u8), |
| 950 | path: ?[]const u8 = null, | 950 | path: ?[]const u8 = null, |
| 951 | // 1-indexed | 951 | // 1-indexed |
| 952 | line: u32 = undefined, | 952 | line: u32 = undefined, |
| ... | @@ -956,7 +956,7 @@ const MsgWriter = struct { | ... | @@ -956,7 +956,7 @@ const MsgWriter = struct { |
| 956 | 956 | ||
| 957 | fn init(allocator: std.mem.Allocator) MsgWriter { | 957 | fn init(allocator: std.mem.Allocator) MsgWriter { |
| 958 | return .{ | 958 | return .{ |
| 959 | .buf = std.ArrayList(u8).init(allocator), | 959 | .buf = std.array_list.Managed(u8).init(allocator), |
| 960 | }; | 960 | }; |
| 961 | } | 961 | } |
| 962 | 962 |
lib/compiler/resinator/parse.zig+4-4| ... | @@ -82,7 +82,7 @@ pub const Parser = struct { | ... | @@ -82,7 +82,7 @@ pub const Parser = struct { |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | fn parseRoot(self: *Self) Error!*Node { | 84 | 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); |
| 86 | defer statements.deinit(); | 86 | defer statements.deinit(); |
| 87 | 87 | ||
| 88 | try self.parseStatements(&statements); | 88 | try self.parseStatements(&statements); |
| ... | @@ -95,7 +95,7 @@ pub const Parser = struct { | ... | @@ -95,7 +95,7 @@ pub const Parser = struct { |
| 95 | return &node.base; | 95 | return &node.base; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | fn parseStatements(self: *Self, statements: *std.ArrayList(*Node)) Error!void { | 98 | fn parseStatements(self: *Self, statements: *std.array_list.Managed(*Node)) Error!void { |
| 99 | while (true) { | 99 | while (true) { |
| 100 | try self.nextToken(.whitespace_delimiter_only); | 100 | try self.nextToken(.whitespace_delimiter_only); |
| 101 | if (self.state.token.id == .eof) break; | 101 | if (self.state.token.id == .eof) break; |
| ... | @@ -355,7 +355,7 @@ pub const Parser = struct { | ... | @@ -355,7 +355,7 @@ pub const Parser = struct { |
| 355 | const begin_token = self.state.token; | 355 | const begin_token = self.state.token; |
| 356 | try self.check(.begin); | 356 | try self.check(.begin); |
| 357 | 357 | ||
| 358 | var strings = std.ArrayList(*Node).init(self.state.allocator); | 358 | var strings = std.array_list.Managed(*Node).init(self.state.allocator); |
| 359 | defer strings.deinit(); | 359 | defer strings.deinit(); |
| 360 | while (true) { | 360 | while (true) { |
| 361 | const maybe_end_token = try self.lookaheadToken(.normal); | 361 | const maybe_end_token = try self.lookaheadToken(.normal); |
| ... | @@ -852,7 +852,7 @@ pub const Parser = struct { | ... | @@ -852,7 +852,7 @@ pub const Parser = struct { |
| 852 | /// Expects the current token to be a begin token. | 852 | /// Expects the current token to be a begin token. |
| 853 | /// After return, the current token will be the end token. | 853 | /// After return, the current token will be the end token. |
| 854 | fn parseRawDataBlock(self: *Self) Error![]*Node { | 854 | 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); |
| 856 | defer raw_data.deinit(); | 856 | defer raw_data.deinit(); |
| 857 | while (true) { | 857 | while (true) { |
| 858 | const maybe_end_token = try self.lookaheadToken(.normal); | 858 | const maybe_end_token = try self.lookaheadToken(.normal); |
lib/compiler/resinator/preprocess.zig+3-3| ... | @@ -11,14 +11,14 @@ pub fn preprocess( | ... | @@ -11,14 +11,14 @@ pub fn preprocess( |
| 11 | writer: anytype, | 11 | writer: anytype, |
| 12 | /// Expects argv[0] to be the command name | 12 | /// Expects argv[0] to be the command name |
| 13 | argv: []const []const u8, | 13 | argv: []const []const u8, |
| 14 | maybe_dependencies_list: ?*std.ArrayList([]const u8), | 14 | maybe_dependencies_list: ?*std.array_list.Managed([]const u8), |
| 15 | ) PreprocessError!void { | 15 | ) PreprocessError!void { |
| 16 | try comp.addDefaultPragmaHandlers(); | 16 | try comp.addDefaultPragmaHandlers(); |
| 17 | 17 | ||
| 18 | var driver: aro.Driver = .{ .comp = comp, .aro_name = "arocc" }; | 18 | var driver: aro.Driver = .{ .comp = comp, .aro_name = "arocc" }; |
| 19 | defer driver.deinit(); | 19 | defer driver.deinit(); |
| 20 | 20 | ||
| 21 | var macro_buf = std.ArrayList(u8).init(comp.gpa); | 21 | var macro_buf = std.array_list.Managed(u8).init(comp.gpa); |
| 22 | defer macro_buf.deinit(); | 22 | defer macro_buf.deinit(); |
| 23 | 23 | ||
| 24 | _ = driver.parseArgs(std.io.null_writer, macro_buf.writer(), argv) catch |err| switch (err) { | 24 | _ = driver.parseArgs(std.io.null_writer, macro_buf.writer(), argv) catch |err| switch (err) { |
| ... | @@ -87,7 +87,7 @@ fn hasAnyErrors(comp: *aro.Compilation) bool { | ... | @@ -87,7 +87,7 @@ fn hasAnyErrors(comp: *aro.Compilation) bool { |
| 87 | 87 | ||
| 88 | /// `arena` is used for temporary -D argument strings and the INCLUDE environment variable. | 88 | /// `arena` is used for temporary -D argument strings and the INCLUDE environment variable. |
| 89 | /// The arena should be kept alive at least as long as `argv`. | 89 | /// The arena should be kept alive at least as long as `argv`. |
| 90 | pub fn appendAroArgs(arena: Allocator, argv: *std.ArrayList([]const u8), options: cli.Options, system_include_paths: []const []const u8) !void { | 90 | pub fn appendAroArgs(arena: Allocator, argv: *std.array_list.Managed([]const u8), options: cli.Options, system_include_paths: []const []const u8) !void { |
| 91 | try argv.appendSlice(&.{ | 91 | try argv.appendSlice(&.{ |
| 92 | "-E", | 92 | "-E", |
| 93 | "--comments", | 93 | "--comments", |
lib/compiler/resinator/res.zig+1-1| ... | @@ -283,7 +283,7 @@ pub const NameOrOrdinal = union(enum) { | ... | @@ -283,7 +283,7 @@ pub const NameOrOrdinal = union(enum) { |
| 283 | 283 | ||
| 284 | pub fn nameFromString(allocator: Allocator, bytes: SourceBytes) !NameOrOrdinal { | 284 | pub fn nameFromString(allocator: Allocator, bytes: SourceBytes) !NameOrOrdinal { |
| 285 | // Names have a limit of 256 UTF-16 code units + null terminator | 285 | // 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)); |
| 287 | errdefer buf.deinit(); | 287 | errdefer buf.deinit(); |
| 288 | 288 | ||
| 289 | var i: usize = 0; | 289 | 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 | ... | @@ -574,7 +574,7 @@ fn parseFilename(allocator: Allocator, str: []const u8) error{ OutOfMemory, Inva |
| 574 | escape_u, | 574 | escape_u, |
| 575 | }; | 575 | }; |
| 576 | 576 | ||
| 577 | var filename = try std.ArrayList(u8).initCapacity(allocator, str.len); | 577 | var filename = try std.array_list.Managed(u8).initCapacity(allocator, str.len); |
| 578 | errdefer filename.deinit(); | 578 | errdefer filename.deinit(); |
| 579 | var state: State = .string; | 579 | var state: State = .string; |
| 580 | var index: usize = 0; | 580 | var index: usize = 0; |
lib/compiler/resinator/windows1252.zig+1-1| ... | @@ -574,7 +574,7 @@ pub fn bestFitFromCodepoint(codepoint: u21) ?u8 { | ... | @@ -574,7 +574,7 @@ pub fn bestFitFromCodepoint(codepoint: u21) ?u8 { |
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | test "windows-1252 to utf8" { | 576 | test "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); |
| 578 | defer buf.deinit(); | 578 | defer buf.deinit(); |
| 579 | 579 | ||
| 580 | 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"; | 580 | 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 { | ... | @@ -1119,7 +1119,7 @@ fn testRender(input: []const u8, expected: []const u8) !void { |
| 1119 | var doc = try parser.endInput(); | 1119 | var doc = try parser.endInput(); |
| 1120 | defer doc.deinit(testing.allocator); | 1120 | defer doc.deinit(testing.allocator); |
| 1121 | 1121 | ||
| 1122 | var actual = std.ArrayList(u8).init(testing.allocator); | 1122 | var actual = std.array_list.Managed(u8).init(testing.allocator); |
| 1123 | defer actual.deinit(); | 1123 | defer actual.deinit(); |
| 1124 | try doc.render(actual.writer()); | 1124 | try doc.render(actual.writer()); |
| 1125 | 1125 |
lib/init/src/main.zig+4-3| ... | @@ -8,9 +8,10 @@ pub fn main() !void { | ... | @@ -8,9 +8,10 @@ pub fn main() !void { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | test "simple test" { | 10 | test "simple test" { |
| 11 | var list = std.ArrayList(i32).init(std.testing.allocator); | 11 | const gpa = std.testing.allocator; |
| 12 | defer list.deinit(); // Try commenting this out and see if zig detects the memory leak! | 12 | var list: std.ArrayList(i32) = .empty; |
| 13 | try list.append(42); | 13 | defer list.deinit(gpa); // Try commenting this out and see if zig detects the memory leak! |
| 14 | try list.append(gpa, 42); | ||
| 14 | try std.testing.expectEqual(@as(i32, 42), list.pop()); | 15 | try std.testing.expectEqual(@as(i32, 42), list.pop()); |
| 15 | } | 16 | } |
| 16 | 17 |
lib/std/BitStack.zig+3-3| ... | @@ -4,14 +4,14 @@ const BitStack = @This(); | ... | @@ -4,14 +4,14 @@ const BitStack = @This(); |
| 4 | 4 | ||
| 5 | const std = @import("std"); | 5 | const std = @import("std"); |
| 6 | const Allocator = std.mem.Allocator; | 6 | const Allocator = std.mem.Allocator; |
| 7 | const ArrayList = std.ArrayList; | 7 | const ArrayList = std.array_list.Managed; |
| 8 | 8 | ||
| 9 | bytes: std.ArrayList(u8), | 9 | bytes: std.array_list.Managed(u8), |
| 10 | bit_len: usize = 0, | 10 | bit_len: usize = 0, |
| 11 | 11 | ||
| 12 | pub fn init(allocator: Allocator) @This() { | 12 | pub fn init(allocator: Allocator) @This() { |
| 13 | return .{ | 13 | return .{ |
| 14 | .bytes = std.ArrayList(u8).init(allocator), | 14 | .bytes = std.array_list.Managed(u8).init(allocator), |
| 15 | }; | 15 | }; |
| 16 | } | 16 | } |
| 17 | 17 |
lib/std/Build.zig+20-20| ... | @@ -7,7 +7,6 @@ const debug = std.debug; | ... | @@ -7,7 +7,6 @@ const debug = std.debug; |
| 7 | const panic = std.debug.panic; | 7 | const panic = std.debug.panic; |
| 8 | const assert = debug.assert; | 8 | const assert = debug.assert; |
| 9 | const log = std.log; | 9 | const log = std.log; |
| 10 | const ArrayList = std.ArrayList; | ||
| 11 | const StringHashMap = std.StringHashMap; | 10 | const StringHashMap = std.StringHashMap; |
| 12 | const Allocator = mem.Allocator; | 11 | const Allocator = mem.Allocator; |
| 13 | const Target = std.Target; | 12 | const Target = std.Target; |
| ... | @@ -16,6 +15,7 @@ const EnvMap = std.process.EnvMap; | ... | @@ -16,6 +15,7 @@ const EnvMap = std.process.EnvMap; |
| 16 | const File = fs.File; | 15 | const File = fs.File; |
| 17 | const Sha256 = std.crypto.hash.sha2.Sha256; | 16 | const Sha256 = std.crypto.hash.sha2.Sha256; |
| 18 | const Build = @This(); | 17 | const Build = @This(); |
| 18 | const ArrayList = std.ArrayList; | ||
| 19 | 19 | ||
| 20 | pub const Cache = @import("Build/Cache.zig"); | 20 | pub const Cache = @import("Build/Cache.zig"); |
| 21 | pub const Step = @import("Build/Step.zig"); | 21 | pub const Step = @import("Build/Step.zig"); |
| ... | @@ -32,7 +32,7 @@ uninstall_tls: TopLevelStep, | ... | @@ -32,7 +32,7 @@ uninstall_tls: TopLevelStep, |
| 32 | allocator: Allocator, | 32 | allocator: Allocator, |
| 33 | user_input_options: UserInputOptionsMap, | 33 | user_input_options: UserInputOptionsMap, |
| 34 | available_options_map: AvailableOptionsMap, | 34 | available_options_map: AvailableOptionsMap, |
| 35 | available_options_list: ArrayList(AvailableOption), | 35 | available_options_list: std.array_list.Managed(AvailableOption), |
| 36 | verbose: bool, | 36 | verbose: bool, |
| 37 | verbose_link: bool, | 37 | verbose_link: bool, |
| 38 | verbose_cc: bool, | 38 | verbose_cc: bool, |
| ... | @@ -52,7 +52,7 @@ exe_dir: []const u8, | ... | @@ -52,7 +52,7 @@ exe_dir: []const u8, |
| 52 | h_dir: []const u8, | 52 | h_dir: []const u8, |
| 53 | install_path: []const u8, | 53 | install_path: []const u8, |
| 54 | sysroot: ?[]const u8 = null, | 54 | sysroot: ?[]const u8 = null, |
| 55 | search_prefixes: std.ArrayListUnmanaged([]const u8), | 55 | search_prefixes: ArrayList([]const u8), |
| 56 | libc_file: ?[]const u8 = null, | 56 | libc_file: ?[]const u8 = null, |
| 57 | /// Path to the directory containing build.zig. | 57 | /// Path to the directory containing build.zig. |
| 58 | build_root: Cache.Directory, | 58 | build_root: Cache.Directory, |
| ... | @@ -220,10 +220,10 @@ const UserInputOption = struct { | ... | @@ -220,10 +220,10 @@ const UserInputOption = struct { |
| 220 | const UserValue = union(enum) { | 220 | const UserValue = union(enum) { |
| 221 | flag: void, | 221 | flag: void, |
| 222 | scalar: []const u8, | 222 | scalar: []const u8, |
| 223 | list: ArrayList([]const u8), | 223 | list: std.array_list.Managed([]const u8), |
| 224 | map: StringHashMap(*const UserValue), | 224 | map: StringHashMap(*const UserValue), |
| 225 | lazy_path: LazyPath, | 225 | lazy_path: LazyPath, |
| 226 | lazy_path_list: ArrayList(LazyPath), | 226 | lazy_path_list: std.array_list.Managed(LazyPath), |
| 227 | }; | 227 | }; |
| 228 | 228 | ||
| 229 | const TypeId = enum { | 229 | const TypeId = enum { |
| ... | @@ -277,10 +277,10 @@ pub fn create( | ... | @@ -277,10 +277,10 @@ pub fn create( |
| 277 | .allocator = arena, | 277 | .allocator = arena, |
| 278 | .user_input_options = UserInputOptionsMap.init(arena), | 278 | .user_input_options = UserInputOptionsMap.init(arena), |
| 279 | .available_options_map = AvailableOptionsMap.init(arena), | 279 | .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), |
| 281 | .top_level_steps = .{}, | 281 | .top_level_steps = .{}, |
| 282 | .default_step = undefined, | 282 | .default_step = undefined, |
| 283 | .search_prefixes = .{}, | 283 | .search_prefixes = .empty, |
| 284 | .install_prefix = undefined, | 284 | .install_prefix = undefined, |
| 285 | .lib_dir = undefined, | 285 | .lib_dir = undefined, |
| 286 | .exe_dir = undefined, | 286 | .exe_dir = undefined, |
| ... | @@ -363,7 +363,7 @@ fn createChildOnly( | ... | @@ -363,7 +363,7 @@ fn createChildOnly( |
| 363 | }, | 363 | }, |
| 364 | .user_input_options = user_input_options, | 364 | .user_input_options = user_input_options, |
| 365 | .available_options_map = AvailableOptionsMap.init(allocator), | 365 | .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), |
| 367 | .verbose = parent.verbose, | 367 | .verbose = parent.verbose, |
| 368 | .verbose_link = parent.verbose_link, | 368 | .verbose_link = parent.verbose_link, |
| 369 | .verbose_cc = parent.verbose_cc, | 369 | .verbose_cc = parent.verbose_cc, |
| ... | @@ -468,7 +468,7 @@ fn addUserInputOptionFromArg( | ... | @@ -468,7 +468,7 @@ fn addUserInputOptionFromArg( |
| 468 | }) catch @panic("OOM"); | 468 | }) catch @panic("OOM"); |
| 469 | }, | 469 | }, |
| 470 | []const LazyPath => return if (maybe_value) |v| { | 470 | []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"); |
| 472 | for (v) |lp| list.appendAssumeCapacity(lp.dupeInner(arena)); | 472 | for (v) |lp| list.appendAssumeCapacity(lp.dupeInner(arena)); |
| 473 | map.put(field.name, .{ | 473 | map.put(field.name, .{ |
| 474 | .name = field.name, | 474 | .name = field.name, |
| ... | @@ -484,7 +484,7 @@ fn addUserInputOptionFromArg( | ... | @@ -484,7 +484,7 @@ fn addUserInputOptionFromArg( |
| 484 | }) catch @panic("OOM"); | 484 | }) catch @panic("OOM"); |
| 485 | }, | 485 | }, |
| 486 | []const []const u8 => return if (maybe_value) |v| { | 486 | []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"); |
| 488 | for (v) |s| list.appendAssumeCapacity(arena.dupe(u8, s) catch @panic("OOM")); | 488 | for (v) |s| list.appendAssumeCapacity(arena.dupe(u8, s) catch @panic("OOM")); |
| 489 | map.put(field.name, .{ | 489 | map.put(field.name, .{ |
| 490 | .name = field.name, | 490 | .name = field.name, |
| ... | @@ -542,7 +542,7 @@ fn addUserInputOptionFromArg( | ... | @@ -542,7 +542,7 @@ fn addUserInputOptionFromArg( |
| 542 | }, | 542 | }, |
| 543 | .slice => switch (@typeInfo(ptr_info.child)) { | 543 | .slice => switch (@typeInfo(ptr_info.child)) { |
| 544 | .@"enum" => return if (maybe_value) |v| { | 544 | .@"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"); |
| 546 | for (v) |tag| list.appendAssumeCapacity(@tagName(tag)); | 546 | for (v) |tag| list.appendAssumeCapacity(@tagName(tag)); |
| 547 | map.put(field.name, .{ | 547 | map.put(field.name, .{ |
| 548 | .name = field.name, | 548 | .name = field.name, |
| ... | @@ -589,10 +589,10 @@ fn addUserInputOptionFromArg( | ... | @@ -589,10 +589,10 @@ fn addUserInputOptionFromArg( |
| 589 | const OrderedUserValue = union(enum) { | 589 | const OrderedUserValue = union(enum) { |
| 590 | flag: void, | 590 | flag: void, |
| 591 | scalar: []const u8, | 591 | scalar: []const u8, |
| 592 | list: ArrayList([]const u8), | 592 | list: std.array_list.Managed([]const u8), |
| 593 | map: ArrayList(Pair), | 593 | map: std.array_list.Managed(Pair), |
| 594 | lazy_path: LazyPath, | 594 | lazy_path: LazyPath, |
| 595 | lazy_path_list: ArrayList(LazyPath), | 595 | lazy_path_list: std.array_list.Managed(LazyPath), |
| 596 | 596 | ||
| 597 | const Pair = struct { | 597 | const Pair = struct { |
| 598 | name: []const u8, | 598 | name: []const u8, |
| ... | @@ -642,8 +642,8 @@ const OrderedUserValue = union(enum) { | ... | @@ -642,8 +642,8 @@ const OrderedUserValue = union(enum) { |
| 642 | } | 642 | } |
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | fn mapFromUnordered(allocator: Allocator, unordered: std.StringHashMap(*const UserValue)) ArrayList(Pair) { | 645 | fn mapFromUnordered(allocator: Allocator, unordered: std.StringHashMap(*const UserValue)) std.array_list.Managed(Pair) { |
| 646 | var ordered = ArrayList(Pair).init(allocator); | 646 | var ordered = std.array_list.Managed(Pair).init(allocator); |
| 647 | var it = unordered.iterator(); | 647 | var it = unordered.iterator(); |
| 648 | while (it.next()) |entry| { | 648 | while (it.next()) |entry| { |
| 649 | ordered.append(.{ | 649 | ordered.append(.{ |
| ... | @@ -694,7 +694,7 @@ const OrderedUserInputOption = struct { | ... | @@ -694,7 +694,7 @@ const OrderedUserInputOption = struct { |
| 694 | // The hash should be consistent with the same values given a different order. | 694 | // The hash should be consistent with the same values given a different order. |
| 695 | // This function takes a user input map, orders it, then hashes the contents. | 695 | // This function takes a user input map, orders it, then hashes the contents. |
| 696 | fn hashUserInputOptionsMap(allocator: Allocator, user_input_options: UserInputOptionsMap, hasher: *std.hash.Wyhash) void { | 696 | fn 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); |
| 698 | var it = user_input_options.iterator(); | 698 | var it = user_input_options.iterator(); |
| 699 | while (it.next()) |entry| | 699 | while (it.next()) |entry| |
| 700 | ordered.append(OrderedUserInputOption.fromUnordered(allocator, entry.value_ptr.*)) catch @panic("OOM"); | 700 | 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 | ... | @@ -1086,7 +1086,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw |
| 1086 | const enum_options = if (type_id == .@"enum" or type_id == .enum_list) blk: { | 1086 | const enum_options = if (type_id == .@"enum" or type_id == .enum_list) blk: { |
| 1087 | const EnumType = if (type_id == .enum_list) @typeInfo(T).pointer.child else T; | 1087 | const EnumType = if (type_id == .enum_list) @typeInfo(T).pointer.child else T; |
| 1088 | const fields = comptime std.meta.fields(EnumType); | 1088 | 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"); |
| 1090 | 1090 | ||
| 1091 | inline for (fields) |field| { | 1091 | inline for (fields) |field| { |
| 1092 | options.appendAssumeCapacity(field.name); | 1092 | options.appendAssumeCapacity(field.name); |
| ... | @@ -1488,7 +1488,7 @@ pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8 | ... | @@ -1488,7 +1488,7 @@ pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8 |
| 1488 | switch (gop.value_ptr.value) { | 1488 | switch (gop.value_ptr.value) { |
| 1489 | .scalar => |s| { | 1489 | .scalar => |s| { |
| 1490 | // turn it into a list | 1490 | // 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); |
| 1492 | try list.append(s); | 1492 | try list.append(s); |
| 1493 | try list.append(value); | 1493 | try list.append(value); |
| 1494 | try b.user_input_options.put(name, .{ | 1494 | try b.user_input_options.put(name, .{ |
| ... | @@ -1596,7 +1596,7 @@ pub fn validateUserInputDidItFail(b: *Build) bool { | ... | @@ -1596,7 +1596,7 @@ pub fn validateUserInputDidItFail(b: *Build) bool { |
| 1596 | } | 1596 | } |
| 1597 | 1597 | ||
| 1598 | fn allocPrintCmd(gpa: Allocator, opt_cwd: ?[]const u8, argv: []const []const u8) error{OutOfMemory}![]u8 { | 1598 | fn 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; |
| 1600 | if (opt_cwd) |cwd| try buf.print(gpa, "cd {s} && ", .{cwd}); | 1600 | if (opt_cwd) |cwd| try buf.print(gpa, "cd {s} && ", .{cwd}); |
| 1601 | for (argv) |arg| { | 1601 | for (argv) |arg| { |
| 1602 | try buf.print(gpa, "{s} ", .{arg}); | 1602 | try buf.print(gpa, "{s} ", .{arg}); |
lib/std/Build/Module.zig+9-8| ... | @@ -10,12 +10,12 @@ resolved_target: ?std.Build.ResolvedTarget = null, | ... | @@ -10,12 +10,12 @@ resolved_target: ?std.Build.ResolvedTarget = null, |
| 10 | optimize: ?std.builtin.OptimizeMode = null, | 10 | optimize: ?std.builtin.OptimizeMode = null, |
| 11 | dwarf_format: ?std.dwarf.Format, | 11 | dwarf_format: ?std.dwarf.Format, |
| 12 | 12 | ||
| 13 | c_macros: std.ArrayListUnmanaged([]const u8), | 13 | c_macros: ArrayList([]const u8), |
| 14 | include_dirs: std.ArrayListUnmanaged(IncludeDir), | 14 | include_dirs: ArrayList(IncludeDir), |
| 15 | lib_paths: std.ArrayListUnmanaged(LazyPath), | 15 | lib_paths: ArrayList(LazyPath), |
| 16 | rpaths: std.ArrayListUnmanaged(RPath), | 16 | rpaths: ArrayList(RPath), |
| 17 | frameworks: std.StringArrayHashMapUnmanaged(LinkFrameworkOptions), | 17 | frameworks: std.StringArrayHashMapUnmanaged(LinkFrameworkOptions), |
| 18 | link_objects: std.ArrayListUnmanaged(LinkObject), | 18 | link_objects: ArrayList(LinkObject), |
| 19 | 19 | ||
| 20 | strip: ?bool, | 20 | strip: ?bool, |
| 21 | unwind_tables: ?std.builtin.UnwindTables, | 21 | unwind_tables: ?std.builtin.UnwindTables, |
| ... | @@ -170,7 +170,7 @@ pub const IncludeDir = union(enum) { | ... | @@ -170,7 +170,7 @@ pub const IncludeDir = union(enum) { |
| 170 | pub fn appendZigProcessFlags( | 170 | pub fn appendZigProcessFlags( |
| 171 | include_dir: IncludeDir, | 171 | include_dir: IncludeDir, |
| 172 | b: *std.Build, | 172 | b: *std.Build, |
| 173 | zig_args: *std.ArrayList([]const u8), | 173 | zig_args: *std.array_list.Managed([]const u8), |
| 174 | asking_step: ?*Step, | 174 | asking_step: ?*Step, |
| 175 | ) !void { | 175 | ) !void { |
| 176 | const flag: []const u8, const lazy_path: LazyPath = switch (include_dir) { | 176 | 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 { | ... | @@ -537,7 +537,7 @@ pub fn addCMacro(m: *Module, name: []const u8, value: []const u8) void { |
| 537 | 537 | ||
| 538 | pub fn appendZigProcessFlags( | 538 | pub fn appendZigProcessFlags( |
| 539 | m: *Module, | 539 | m: *Module, |
| 540 | zig_args: *std.ArrayList([]const u8), | 540 | zig_args: *std.array_list.Managed([]const u8), |
| 541 | asking_step: ?*Step, | 541 | asking_step: ?*Step, |
| 542 | ) !void { | 542 | ) !void { |
| 543 | const b = m.owner; | 543 | const b = m.owner; |
| ... | @@ -634,7 +634,7 @@ pub fn appendZigProcessFlags( | ... | @@ -634,7 +634,7 @@ pub fn appendZigProcessFlags( |
| 634 | } | 634 | } |
| 635 | 635 | ||
| 636 | fn addFlag( | 636 | fn addFlag( |
| 637 | args: *std.ArrayList([]const u8), | 637 | args: *std.array_list.Managed([]const u8), |
| 638 | opt: ?bool, | 638 | opt: ?bool, |
| 639 | then_name: []const u8, | 639 | then_name: []const u8, |
| 640 | else_name: []const u8, | 640 | else_name: []const u8, |
| ... | @@ -706,3 +706,4 @@ const std = @import("std"); | ... | @@ -706,3 +706,4 @@ const std = @import("std"); |
| 706 | const assert = std.debug.assert; | 706 | const assert = std.debug.assert; |
| 707 | const LazyPath = std.Build.LazyPath; | 707 | const LazyPath = std.Build.LazyPath; |
| 708 | const Step = std.Build.Step; | 708 | const Step = std.Build.Step; |
| 709 | const ArrayList = std.ArrayList; |
lib/std/Build/Step.zig+17-16| ... | @@ -1,12 +1,22 @@ | ... | @@ -1,12 +1,22 @@ |
| 1 | const Step = @This(); | ||
| 2 | const std = @import("../std.zig"); | ||
| 3 | const Build = std.Build; | ||
| 4 | const Allocator = std.mem.Allocator; | ||
| 5 | const assert = std.debug.assert; | ||
| 6 | const builtin = @import("builtin"); | ||
| 7 | const Cache = Build.Cache; | ||
| 8 | const Path = Cache.Path; | ||
| 9 | const ArrayList = std.ArrayList; | ||
| 10 | |||
| 1 | id: Id, | 11 | id: Id, |
| 2 | name: []const u8, | 12 | name: []const u8, |
| 3 | owner: *Build, | 13 | owner: *Build, |
| 4 | makeFn: MakeFn, | 14 | makeFn: MakeFn, |
| 5 | 15 | ||
| 6 | dependencies: std.ArrayList(*Step), | 16 | dependencies: std.array_list.Managed(*Step), |
| 7 | /// This field is empty during execution of the user's build script, and | 17 | /// This field is empty during execution of the user's build script, and |
| 8 | /// then populated during dependency loop checking in the build runner. | 18 | /// then populated during dependency loop checking in the build runner. |
| 9 | dependants: std.ArrayListUnmanaged(*Step), | 19 | dependants: ArrayList(*Step), |
| 10 | /// Collects the set of files that retrigger this step to run. | 20 | /// Collects the set of files that retrigger this step to run. |
| 11 | /// | 21 | /// |
| 12 | /// This is used by the build system's implementation of `--watch` but it can | 22 | /// This is used by the build system's implementation of `--watch` but it can |
| ... | @@ -39,7 +49,7 @@ state: State, | ... | @@ -39,7 +49,7 @@ state: State, |
| 39 | /// total system memory available. | 49 | /// total system memory available. |
| 40 | max_rss: usize, | 50 | max_rss: usize, |
| 41 | 51 | ||
| 42 | result_error_msgs: std.ArrayListUnmanaged([]const u8), | 52 | result_error_msgs: ArrayList([]const u8), |
| 43 | result_error_bundle: std.zig.ErrorBundle, | 53 | result_error_bundle: std.zig.ErrorBundle, |
| 44 | result_stderr: []const u8, | 54 | result_stderr: []const u8, |
| 45 | result_cached: bool, | 55 | result_cached: bool, |
| ... | @@ -175,7 +185,7 @@ pub const Inputs = struct { | ... | @@ -175,7 +185,7 @@ pub const Inputs = struct { |
| 175 | 185 | ||
| 176 | pub const Table = std.ArrayHashMapUnmanaged(Build.Cache.Path, Files, Build.Cache.Path.TableAdapter, false); | 186 | pub const Table = std.ArrayHashMapUnmanaged(Build.Cache.Path, Files, Build.Cache.Path.TableAdapter, false); |
| 177 | /// The special file name "." means any changes inside the directory. | 187 | /// 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); |
| 179 | 189 | ||
| 180 | pub fn populated(inputs: *Inputs) bool { | 190 | pub fn populated(inputs: *Inputs) bool { |
| 181 | return inputs.table.count() != 0; | 191 | return inputs.table.count() != 0; |
| ... | @@ -204,8 +214,8 @@ pub fn init(options: StepOptions) Step { | ... | @@ -204,8 +214,8 @@ pub fn init(options: StepOptions) Step { |
| 204 | .name = arena.dupe(u8, options.name) catch @panic("OOM"), | 214 | .name = arena.dupe(u8, options.name) catch @panic("OOM"), |
| 205 | .owner = options.owner, | 215 | .owner = options.owner, |
| 206 | .makeFn = options.makeFn, | 216 | .makeFn = options.makeFn, |
| 207 | .dependencies = std.ArrayList(*Step).init(arena), | 217 | .dependencies = std.array_list.Managed(*Step).init(arena), |
| 208 | .dependants = .{}, | 218 | .dependants = .empty, |
| 209 | .inputs = Inputs.init, | 219 | .inputs = Inputs.init, |
| 210 | .state = .precheck_unstarted, | 220 | .state = .precheck_unstarted, |
| 211 | .max_rss = options.max_rss, | 221 | .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 | ... | @@ -326,15 +336,6 @@ pub fn dump(step: *Step, w: *std.Io.Writer, tty_config: std.Io.tty.Config) void |
| 326 | } | 336 | } |
| 327 | } | 337 | } |
| 328 | 338 | ||
| 329 | const Step = @This(); | ||
| 330 | const std = @import("../std.zig"); | ||
| 331 | const Build = std.Build; | ||
| 332 | const Allocator = std.mem.Allocator; | ||
| 333 | const assert = std.debug.assert; | ||
| 334 | const builtin = @import("builtin"); | ||
| 335 | const Cache = Build.Cache; | ||
| 336 | const Path = Cache.Path; | ||
| 337 | |||
| 338 | pub fn evalChildProcess(s: *Step, argv: []const []const u8) ![]u8 { | 339 | pub fn evalChildProcess(s: *Step, argv: []const []const u8) ![]u8 { |
| 339 | const run_result = try captureChildProcess(s, std.Progress.Node.none, argv); | 340 | const run_result = try captureChildProcess(s, std.Progress.Node.none, argv); |
| 340 | try handleChildProcessTerm(s, run_result.term, null, argv); | 341 | try handleChildProcessTerm(s, run_result.term, null, argv); |
| ... | @@ -980,7 +981,7 @@ fn addDirectoryWatchInputFromBuilder(step: *Step, builder: *Build, sub_path: []c | ... | @@ -980,7 +981,7 @@ fn addDirectoryWatchInputFromBuilder(step: *Step, builder: *Build, sub_path: []c |
| 980 | fn addWatchInputFromPath(step: *Step, path: Build.Cache.Path, basename: []const u8) !void { | 981 | fn addWatchInputFromPath(step: *Step, path: Build.Cache.Path, basename: []const u8) !void { |
| 981 | const gpa = step.owner.allocator; | 982 | const gpa = step.owner.allocator; |
| 982 | const gop = try step.inputs.table.getOrPut(gpa, path); | 983 | 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; |
| 984 | try gop.value_ptr.append(gpa, basename); | 985 | try gop.value_ptr.append(gpa, basename); |
| 985 | } | 986 | } |
| 986 | 987 |
lib/std/Build/Step/CheckObject.zig+23-23| ... | @@ -18,7 +18,7 @@ pub const base_id: Step.Id = .check_object; | ... | @@ -18,7 +18,7 @@ pub const base_id: Step.Id = .check_object; |
| 18 | step: Step, | 18 | step: Step, |
| 19 | source: std.Build.LazyPath, | 19 | source: std.Build.LazyPath, |
| 20 | max_bytes: usize = 20 * 1024 * 1024, | 20 | max_bytes: usize = 20 * 1024 * 1024, |
| 21 | checks: std.ArrayList(Check), | 21 | checks: std.array_list.Managed(Check), |
| 22 | obj_format: std.Target.ObjectFormat, | 22 | obj_format: std.Target.ObjectFormat, |
| 23 | 23 | ||
| 24 | pub fn create( | 24 | pub fn create( |
| ... | @@ -36,7 +36,7 @@ pub fn create( | ... | @@ -36,7 +36,7 @@ pub fn create( |
| 36 | .makeFn = make, | 36 | .makeFn = make, |
| 37 | }), | 37 | }), |
| 38 | .source = source.dupe(owner), | 38 | .source = source.dupe(owner), |
| 39 | .checks = std.ArrayList(Check).init(gpa), | 39 | .checks = std.array_list.Managed(Check).init(gpa), |
| 40 | .obj_format = obj_format, | 40 | .obj_format = obj_format, |
| 41 | }; | 41 | }; |
| 42 | check_object.source.addStepDependencies(&check_object.step); | 42 | check_object.source.addStepDependencies(&check_object.step); |
| ... | @@ -81,7 +81,7 @@ const Action = struct { | ... | @@ -81,7 +81,7 @@ const Action = struct { |
| 81 | const hay = mem.trim(u8, haystack, " "); | 81 | const hay = mem.trim(u8, haystack, " "); |
| 82 | const phrase = mem.trim(u8, act.phrase.resolve(b, step), " "); | 82 | const phrase = mem.trim(u8, act.phrase.resolve(b, step), " "); |
| 83 | 83 | ||
| 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); |
| 85 | var hay_it = mem.tokenizeScalar(u8, hay, ' '); | 85 | var hay_it = mem.tokenizeScalar(u8, hay, ' '); |
| 86 | var needle_it = mem.tokenizeScalar(u8, phrase, ' '); | 86 | var needle_it = mem.tokenizeScalar(u8, phrase, ' '); |
| 87 | 87 | ||
| ... | @@ -157,8 +157,8 @@ const Action = struct { | ... | @@ -157,8 +157,8 @@ const Action = struct { |
| 157 | fn computeCmp(act: Action, b: *std.Build, step: *Step, global_vars: anytype) !bool { | 157 | fn computeCmp(act: Action, b: *std.Build, step: *Step, global_vars: anytype) !bool { |
| 158 | const gpa = step.owner.allocator; | 158 | const gpa = step.owner.allocator; |
| 159 | const phrase = act.phrase.resolve(b, step); | 159 | const phrase = act.phrase.resolve(b, step); |
| 160 | var op_stack = std.ArrayList(enum { add, sub, mod, mul }).init(gpa); | 160 | var op_stack = std.array_list.Managed(enum { add, sub, mod, mul }).init(gpa); |
| 161 | var values = std.ArrayList(u64).init(gpa); | 161 | var values = std.array_list.Managed(u64).init(gpa); |
| 162 | 162 | ||
| 163 | var it = mem.tokenizeScalar(u8, phrase, ' '); | 163 | var it = mem.tokenizeScalar(u8, phrase, ' '); |
| 164 | while (it.next()) |next| { | 164 | while (it.next()) |next| { |
| ... | @@ -242,15 +242,15 @@ const ComputeCompareExpected = struct { | ... | @@ -242,15 +242,15 @@ const ComputeCompareExpected = struct { |
| 242 | const Check = struct { | 242 | const Check = struct { |
| 243 | kind: Kind, | 243 | kind: Kind, |
| 244 | payload: Payload, | 244 | payload: Payload, |
| 245 | data: std.ArrayList(u8), | 245 | data: std.array_list.Managed(u8), |
| 246 | actions: std.ArrayList(Action), | 246 | actions: std.array_list.Managed(Action), |
| 247 | 247 | ||
| 248 | fn create(allocator: Allocator, kind: Kind) Check { | 248 | fn create(allocator: Allocator, kind: Kind) Check { |
| 249 | return .{ | 249 | return .{ |
| 250 | .kind = kind, | 250 | .kind = kind, |
| 251 | .payload = .{ .none = {} }, | 251 | .payload = .{ .none = {} }, |
| 252 | .data = std.ArrayList(u8).init(allocator), | 252 | .data = std.array_list.Managed(u8).init(allocator), |
| 253 | .actions = std.ArrayList(Action).init(allocator), | 253 | .actions = std.array_list.Managed(Action).init(allocator), |
| 254 | }; | 254 | }; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| ... | @@ -1214,7 +1214,7 @@ const MachODumper = struct { | ... | @@ -1214,7 +1214,7 @@ const MachODumper = struct { |
| 1214 | } | 1214 | } |
| 1215 | 1215 | ||
| 1216 | fn dumpRebaseInfo(ctx: ObjectContext, data: []const u8, writer: anytype) !void { | 1216 | 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); |
| 1218 | defer rebases.deinit(); | 1218 | defer rebases.deinit(); |
| 1219 | try ctx.parseRebaseInfo(data, &rebases); | 1219 | try ctx.parseRebaseInfo(data, &rebases); |
| 1220 | mem.sort(u64, rebases.items, {}, std.sort.asc(u64)); | 1220 | mem.sort(u64, rebases.items, {}, std.sort.asc(u64)); |
| ... | @@ -1223,7 +1223,7 @@ const MachODumper = struct { | ... | @@ -1223,7 +1223,7 @@ const MachODumper = struct { |
| 1223 | } | 1223 | } |
| 1224 | } | 1224 | } |
| 1225 | 1225 | ||
| 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 { |
| 1227 | var stream = std.io.fixedBufferStream(data); | 1227 | var stream = std.io.fixedBufferStream(data); |
| 1228 | var creader = std.io.countingReader(stream.reader()); | 1228 | var creader = std.io.countingReader(stream.reader()); |
| 1229 | const reader = creader.reader(); | 1229 | const reader = creader.reader(); |
| ... | @@ -1313,7 +1313,7 @@ const MachODumper = struct { | ... | @@ -1313,7 +1313,7 @@ const MachODumper = struct { |
| 1313 | }; | 1313 | }; |
| 1314 | 1314 | ||
| 1315 | fn dumpBindInfo(ctx: ObjectContext, data: []const u8, writer: anytype) !void { | 1315 | 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); |
| 1317 | defer { | 1317 | defer { |
| 1318 | for (bindings.items) |*b| { | 1318 | for (bindings.items) |*b| { |
| 1319 | b.deinit(ctx.gpa); | 1319 | b.deinit(ctx.gpa); |
| ... | @@ -1335,7 +1335,7 @@ const MachODumper = struct { | ... | @@ -1335,7 +1335,7 @@ const MachODumper = struct { |
| 1335 | } | 1335 | } |
| 1336 | } | 1336 | } |
| 1337 | 1337 | ||
| 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 { |
| 1339 | var stream = std.io.fixedBufferStream(data); | 1339 | var stream = std.io.fixedBufferStream(data); |
| 1340 | var creader = std.io.countingReader(stream.reader()); | 1340 | var creader = std.io.countingReader(stream.reader()); |
| 1341 | const reader = creader.reader(); | 1341 | const reader = creader.reader(); |
| ... | @@ -1346,7 +1346,7 @@ const MachODumper = struct { | ... | @@ -1346,7 +1346,7 @@ const MachODumper = struct { |
| 1346 | var offset: u64 = 0; | 1346 | var offset: u64 = 0; |
| 1347 | var addend: i64 = 0; | 1347 | var addend: i64 = 0; |
| 1348 | 1348 | ||
| 1349 | var name_buf = std.ArrayList(u8).init(ctx.gpa); | 1349 | var name_buf = std.array_list.Managed(u8).init(ctx.gpa); |
| 1350 | defer name_buf.deinit(); | 1350 | defer name_buf.deinit(); |
| 1351 | 1351 | ||
| 1352 | while (true) { | 1352 | while (true) { |
| ... | @@ -1434,7 +1434,7 @@ const MachODumper = struct { | ... | @@ -1434,7 +1434,7 @@ const MachODumper = struct { |
| 1434 | var arena = std.heap.ArenaAllocator.init(ctx.gpa); | 1434 | var arena = std.heap.ArenaAllocator.init(ctx.gpa); |
| 1435 | defer arena.deinit(); | 1435 | defer arena.deinit(); |
| 1436 | 1436 | ||
| 1437 | var exports = std.ArrayList(Export).init(arena.allocator()); | 1437 | var exports = std.array_list.Managed(Export).init(arena.allocator()); |
| 1438 | var it = TrieIterator{ .data = data }; | 1438 | var it = TrieIterator{ .data = data }; |
| 1439 | try parseTrieNode(arena.allocator(), &it, "", &exports); | 1439 | try parseTrieNode(arena.allocator(), &it, "", &exports); |
| 1440 | 1440 | ||
| ... | @@ -1546,7 +1546,7 @@ const MachODumper = struct { | ... | @@ -1546,7 +1546,7 @@ const MachODumper = struct { |
| 1546 | arena: Allocator, | 1546 | arena: Allocator, |
| 1547 | it: *TrieIterator, | 1547 | it: *TrieIterator, |
| 1548 | prefix: []const u8, | 1548 | prefix: []const u8, |
| 1549 | exports: *std.ArrayList(Export), | 1549 | exports: *std.array_list.Managed(Export), |
| 1550 | ) !void { | 1550 | ) !void { |
| 1551 | const size = try it.readUleb128(); | 1551 | const size = try it.readUleb128(); |
| 1552 | if (size > 0) { | 1552 | if (size > 0) { |
| ... | @@ -1621,7 +1621,7 @@ const MachODumper = struct { | ... | @@ -1621,7 +1621,7 @@ const MachODumper = struct { |
| 1621 | var ctx = ObjectContext{ .gpa = gpa, .data = bytes, .header = hdr }; | 1621 | var ctx = ObjectContext{ .gpa = gpa, .data = bytes, .header = hdr }; |
| 1622 | try ctx.parse(); | 1622 | try ctx.parse(); |
| 1623 | 1623 | ||
| 1624 | var output = std.ArrayList(u8).init(gpa); | 1624 | var output = std.array_list.Managed(u8).init(gpa); |
| 1625 | const writer = output.writer(); | 1625 | const writer = output.writer(); |
| 1626 | 1626 | ||
| 1627 | switch (check.kind) { | 1627 | switch (check.kind) { |
| ... | @@ -1787,7 +1787,7 @@ const ElfDumper = struct { | ... | @@ -1787,7 +1787,7 @@ const ElfDumper = struct { |
| 1787 | try ctx.objects.append(gpa, .{ .name = name, .off = stream.pos, .len = size }); | 1787 | try ctx.objects.append(gpa, .{ .name = name, .off = stream.pos, .len = size }); |
| 1788 | } | 1788 | } |
| 1789 | 1789 | ||
| 1790 | var output = std.ArrayList(u8).init(gpa); | 1790 | var output = std.array_list.Managed(u8).init(gpa); |
| 1791 | const writer = output.writer(); | 1791 | const writer = output.writer(); |
| 1792 | 1792 | ||
| 1793 | switch (check.kind) { | 1793 | switch (check.kind) { |
| ... | @@ -1848,7 +1848,7 @@ const ElfDumper = struct { | ... | @@ -1848,7 +1848,7 @@ const ElfDumper = struct { |
| 1848 | files.putAssumeCapacityNoClobber(object.off - @sizeOf(elf.ar_hdr), object.name); | 1848 | files.putAssumeCapacityNoClobber(object.off - @sizeOf(elf.ar_hdr), object.name); |
| 1849 | } | 1849 | } |
| 1850 | 1850 | ||
| 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); |
| 1852 | defer { | 1852 | defer { |
| 1853 | for (symbols.values()) |*value| { | 1853 | for (symbols.values()) |*value| { |
| 1854 | value.deinit(); | 1854 | value.deinit(); |
| ... | @@ -1859,7 +1859,7 @@ const ElfDumper = struct { | ... | @@ -1859,7 +1859,7 @@ const ElfDumper = struct { |
| 1859 | for (ctx.symtab.items) |entry| { | 1859 | for (ctx.symtab.items) |entry| { |
| 1860 | const gop = try symbols.getOrPut(@intCast(entry.off)); | 1860 | const gop = try symbols.getOrPut(@intCast(entry.off)); |
| 1861 | if (!gop.found_existing) { | 1861 | 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); |
| 1863 | } | 1863 | } |
| 1864 | try gop.value_ptr.append(entry.name); | 1864 | try gop.value_ptr.append(entry.name); |
| 1865 | } | 1865 | } |
| ... | @@ -1944,7 +1944,7 @@ const ElfDumper = struct { | ... | @@ -1944,7 +1944,7 @@ const ElfDumper = struct { |
| 1944 | else => {}, | 1944 | else => {}, |
| 1945 | }; | 1945 | }; |
| 1946 | 1946 | ||
| 1947 | var output = std.ArrayList(u8).init(gpa); | 1947 | var output = std.array_list.Managed(u8).init(gpa); |
| 1948 | const writer = output.writer(); | 1948 | const writer = output.writer(); |
| 1949 | 1949 | ||
| 1950 | switch (check.kind) { | 1950 | switch (check.kind) { |
| ... | @@ -2398,7 +2398,7 @@ const WasmDumper = struct { | ... | @@ -2398,7 +2398,7 @@ const WasmDumper = struct { |
| 2398 | return error.UnsupportedWasmVersion; | 2398 | return error.UnsupportedWasmVersion; |
| 2399 | } | 2399 | } |
| 2400 | 2400 | ||
| 2401 | var output = std.ArrayList(u8).init(gpa); | 2401 | var output = std.array_list.Managed(u8).init(gpa); |
| 2402 | defer output.deinit(); | 2402 | defer output.deinit(); |
| 2403 | parseAndDumpInner(step, check, bytes, &fbs, &output) catch |err| switch (err) { | 2403 | parseAndDumpInner(step, check, bytes, &fbs, &output) catch |err| switch (err) { |
| 2404 | error.EndOfStream => try output.appendSlice("\n<UnexpectedEndOfStream>"), | 2404 | error.EndOfStream => try output.appendSlice("\n<UnexpectedEndOfStream>"), |
| ... | @@ -2412,7 +2412,7 @@ const WasmDumper = struct { | ... | @@ -2412,7 +2412,7 @@ const WasmDumper = struct { |
| 2412 | check: Check, | 2412 | check: Check, |
| 2413 | bytes: []const u8, | 2413 | bytes: []const u8, |
| 2414 | fbs: *std.io.FixedBufferStream([]const u8), | 2414 | fbs: *std.io.FixedBufferStream([]const u8), |
| 2415 | output: *std.ArrayList(u8), | 2415 | output: *std.array_list.Managed(u8), |
| 2416 | ) !void { | 2416 | ) !void { |
| 2417 | const reader = fbs.reader(); | 2417 | const reader = fbs.reader(); |
| 2418 | const writer = output.writer(); | 2418 | const writer = output.writer(); |
lib/std/Build/Step/Compile.zig+8-9| ... | @@ -4,7 +4,6 @@ const mem = std.mem; | ... | @@ -4,7 +4,6 @@ const mem = std.mem; |
| 4 | const fs = std.fs; | 4 | const fs = std.fs; |
| 5 | const assert = std.debug.assert; | 5 | const assert = std.debug.assert; |
| 6 | const panic = std.debug.panic; | 6 | const panic = std.debug.panic; |
| 7 | const ArrayList = std.ArrayList; | ||
| 8 | const StringHashMap = std.StringHashMap; | 7 | const StringHashMap = std.StringHashMap; |
| 9 | const Sha256 = std.crypto.hash.sha2.Sha256; | 8 | const Sha256 = std.crypto.hash.sha2.Sha256; |
| 10 | const Allocator = mem.Allocator; | 9 | const Allocator = mem.Allocator; |
| ... | @@ -60,7 +59,7 @@ filters: []const []const u8, | ... | @@ -60,7 +59,7 @@ filters: []const []const u8, |
| 60 | test_runner: ?TestRunner, | 59 | test_runner: ?TestRunner, |
| 61 | wasi_exec_model: ?std.builtin.WasiExecModel = null, | 60 | wasi_exec_model: ?std.builtin.WasiExecModel = null, |
| 62 | 61 | ||
| 63 | installed_headers: ArrayList(HeaderInstallation), | 62 | installed_headers: std.array_list.Managed(HeaderInstallation), |
| 64 | 63 | ||
| 65 | /// This step is used to create an include tree that dependent modules can add to their include | 64 | /// This step is used to create an include tree that dependent modules can add to their include |
| 66 | /// search paths. Installed headers are copied to this step. | 65 | /// search paths. Installed headers are copied to this step. |
| ... | @@ -421,7 +420,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { | ... | @@ -421,7 +420,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 421 | .out_lib_filename = undefined, | 420 | .out_lib_filename = undefined, |
| 422 | .major_only_filename = null, | 421 | .major_only_filename = null, |
| 423 | .name_only_filename = null, | 422 | .name_only_filename = null, |
| 424 | .installed_headers = ArrayList(HeaderInstallation).init(owner.allocator), | 423 | .installed_headers = std.array_list.Managed(HeaderInstallation).init(owner.allocator), |
| 425 | .zig_lib_dir = null, | 424 | .zig_lib_dir = null, |
| 426 | .exec_cmd_args = null, | 425 | .exec_cmd_args = null, |
| 427 | .filters = options.filters, | 426 | .filters = options.filters, |
| ... | @@ -766,9 +765,9 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult { | ... | @@ -766,9 +765,9 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult { |
| 766 | else => return err, | 765 | else => return err, |
| 767 | }; | 766 | }; |
| 768 | 767 | ||
| 769 | var zig_cflags = ArrayList([]const u8).init(b.allocator); | 768 | var zig_cflags = std.array_list.Managed([]const u8).init(b.allocator); |
| 770 | defer zig_cflags.deinit(); | 769 | 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); |
| 772 | defer zig_libs.deinit(); | 771 | defer zig_libs.deinit(); |
| 773 | 772 | ||
| 774 | var arg_it = mem.tokenizeAny(u8, stdout, " \r\n\t"); | 773 | var arg_it = mem.tokenizeAny(u8, stdout, " \r\n\t"); |
| ... | @@ -1076,7 +1075,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { | ... | @@ -1076,7 +1075,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1076 | const b = step.owner; | 1075 | const b = step.owner; |
| 1077 | const arena = b.allocator; | 1076 | const arena = b.allocator; |
| 1078 | 1077 | ||
| 1079 | var zig_args = ArrayList([]const u8).init(arena); | 1078 | var zig_args = std.array_list.Managed([]const u8).init(arena); |
| 1080 | defer zig_args.deinit(); | 1079 | defer zig_args.deinit(); |
| 1081 | 1080 | ||
| 1082 | try zig_args.append(b.graph.zig_exe); | 1081 | try zig_args.append(b.graph.zig_exe); |
| ... | @@ -1798,7 +1797,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { | ... | @@ -1798,7 +1797,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1798 | try b.cache_root.handle.makePath("args"); | 1797 | try b.cache_root.handle.makePath("args"); |
| 1799 | 1798 | ||
| 1800 | const args_to_escape = zig_args.items[2..]; | 1799 | 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); |
| 1802 | arg_blk: for (args_to_escape) |arg| { | 1801 | arg_blk: for (args_to_escape) |arg| { |
| 1803 | for (arg, 0..) |c, arg_idx| { | 1802 | for (arg, 0..) |c, arg_idx| { |
| 1804 | if (c == '\\' or c == '"') { | 1803 | if (c == '\\' or c == '"') { |
| ... | @@ -1948,7 +1947,7 @@ pub fn doAtomicSymLinks( | ... | @@ -1948,7 +1947,7 @@ pub fn doAtomicSymLinks( |
| 1948 | fn execPkgConfigList(b: *std.Build, out_code: *u8) (PkgConfigError || RunError)![]const PkgConfigPkg { | 1947 | fn execPkgConfigList(b: *std.Build, out_code: *u8) (PkgConfigError || RunError)![]const PkgConfigPkg { |
| 1949 | const pkg_config_exe = b.graph.env_map.get("PKG_CONFIG") orelse "pkg-config"; | 1948 | const pkg_config_exe = b.graph.env_map.get("PKG_CONFIG") orelse "pkg-config"; |
| 1950 | const stdout = try b.runAllowFail(&[_][]const u8{ pkg_config_exe, "--list-all" }, out_code, .Ignore); | 1949 | 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); |
| 1952 | errdefer list.deinit(); | 1951 | errdefer list.deinit(); |
| 1953 | var line_it = mem.tokenizeAny(u8, stdout, "\r\n"); | 1952 | var line_it = mem.tokenizeAny(u8, stdout, "\r\n"); |
| 1954 | while (line_it.next()) |line| { | 1953 | while (line_it.next()) |line| { |
| ... | @@ -1985,7 +1984,7 @@ fn getPkgConfigList(b: *std.Build) ![]const PkgConfigPkg { | ... | @@ -1985,7 +1984,7 @@ fn getPkgConfigList(b: *std.Build) ![]const PkgConfigPkg { |
| 1985 | } | 1984 | } |
| 1986 | } | 1985 | } |
| 1987 | 1986 | ||
| 1988 | fn addFlag(args: *ArrayList([]const u8), comptime name: []const u8, opt: ?bool) !void { | 1987 | fn addFlag(args: *std.array_list.Managed([]const u8), comptime name: []const u8, opt: ?bool) !void { |
| 1989 | const cond = opt orelse return; | 1988 | const cond = opt orelse return; |
| 1990 | try args.ensureUnusedCapacity(1); | 1989 | try args.ensureUnusedCapacity(1); |
| 1991 | if (cond) { | 1990 | if (cond) { |
lib/std/Build/Step/ConfigHeader.zig+2-2| ... | @@ -621,7 +621,7 @@ fn expand_variables_cmake( | ... | @@ -621,7 +621,7 @@ fn expand_variables_cmake( |
| 621 | contents: []const u8, | 621 | contents: []const u8, |
| 622 | values: std.StringArrayHashMap(Value), | 622 | values: std.StringArrayHashMap(Value), |
| 623 | ) ![]const u8 { | 623 | ) ![]const u8 { |
| 624 | var result: std.ArrayList(u8) = .init(allocator); | 624 | var result: std.array_list.Managed(u8) = .init(allocator); |
| 625 | errdefer result.deinit(); | 625 | errdefer result.deinit(); |
| 626 | 626 | ||
| 627 | const valid_varname_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/_.+-"; | 627 | const valid_varname_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/_.+-"; |
| ... | @@ -633,7 +633,7 @@ fn expand_variables_cmake( | ... | @@ -633,7 +633,7 @@ fn expand_variables_cmake( |
| 633 | source: usize, | 633 | source: usize, |
| 634 | target: usize, | 634 | target: usize, |
| 635 | }; | 635 | }; |
| 636 | var var_stack: std.ArrayList(Position) = .init(allocator); | 636 | var var_stack: std.array_list.Managed(Position) = .init(allocator); |
| 637 | defer var_stack.deinit(); | 637 | defer var_stack.deinit(); |
| 638 | loop: while (curr < contents.len) : (curr += 1) { | 638 | loop: while (curr < contents.len) : (curr += 1) { |
| 639 | switch (contents[curr]) { | 639 | switch (contents[curr]) { |
lib/std/Build/Step/ObjCopy.zig+1-1| ... | @@ -182,7 +182,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { | ... | @@ -182,7 +182,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 182 | return step.fail("unable to make path {s}: {s}", .{ cache_path, @errorName(err) }); | 182 | return step.fail("unable to make path {s}: {s}", .{ cache_path, @errorName(err) }); |
| 183 | }; | 183 | }; |
| 184 | 184 | ||
| 185 | var argv = std.ArrayList([]const u8).init(b.allocator); | 185 | var argv = std.array_list.Managed([]const u8).init(b.allocator); |
| 186 | try argv.appendSlice(&.{ b.graph.zig_exe, "objcopy" }); | 186 | try argv.appendSlice(&.{ b.graph.zig_exe, "objcopy" }); |
| 187 | 187 | ||
| 188 | if (objcopy.only_section) |only_section| { | 188 | 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 { | ... | @@ -679,15 +679,15 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 679 | const run: *Run = @fieldParentPtr("step", step); | 679 | const run: *Run = @fieldParentPtr("step", step); |
| 680 | const has_side_effects = run.hasSideEffects(); | 680 | const has_side_effects = run.hasSideEffects(); |
| 681 | 681 | ||
| 682 | var argv_list = std.ArrayList([]const u8).init(arena); | 682 | var argv_list = std.array_list.Managed([]const u8).init(arena); |
| 683 | var output_placeholders = std.ArrayList(IndexedOutput).init(arena); | 683 | var output_placeholders = std.array_list.Managed(IndexedOutput).init(arena); |
| 684 | 684 | ||
| 685 | var man = b.graph.cache.obtain(); | 685 | var man = b.graph.cache.obtain(); |
| 686 | defer man.deinit(); | 686 | defer man.deinit(); |
| 687 | 687 | ||
| 688 | if (run.env_map) |env_map| { | 688 | if (run.env_map) |env_map| { |
| 689 | const KV = struct { []const u8, []const u8 }; | 689 | 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()); |
| 691 | var iter = env_map.iterator(); | 691 | var iter = env_map.iterator(); |
| 692 | while (iter.next()) |entry| { | 692 | while (iter.next()) |entry| { |
| 693 | kv_pairs.appendAssumeCapacity(.{ entry.key_ptr.*, entry.value_ptr.* }); | 693 | kv_pairs.appendAssumeCapacity(.{ entry.key_ptr.*, entry.value_ptr.* }); |
| ... | @@ -1080,7 +1080,7 @@ fn runCommand( | ... | @@ -1080,7 +1080,7 @@ fn runCommand( |
| 1080 | else => false, | 1080 | else => false, |
| 1081 | }; | 1081 | }; |
| 1082 | 1082 | ||
| 1083 | var interp_argv = std.ArrayList([]const u8).init(b.allocator); | 1083 | var interp_argv = std.array_list.Managed([]const u8).init(b.allocator); |
| 1084 | defer interp_argv.deinit(); | 1084 | defer interp_argv.deinit(); |
| 1085 | 1085 | ||
| 1086 | var env_map = run.env_map orelse &b.graph.env_map; | 1086 | 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; | ... | @@ -10,8 +10,8 @@ pub const base_id: Step.Id = .translate_c; |
| 10 | 10 | ||
| 11 | step: Step, | 11 | step: Step, |
| 12 | source: std.Build.LazyPath, | 12 | source: std.Build.LazyPath, |
| 13 | include_dirs: std.ArrayList(std.Build.Module.IncludeDir), | 13 | include_dirs: std.array_list.Managed(std.Build.Module.IncludeDir), |
| 14 | c_macros: std.ArrayList([]const u8), | 14 | c_macros: std.array_list.Managed([]const u8), |
| 15 | out_basename: []const u8, | 15 | out_basename: []const u8, |
| 16 | target: std.Build.ResolvedTarget, | 16 | target: std.Build.ResolvedTarget, |
| 17 | optimize: std.builtin.OptimizeMode, | 17 | optimize: std.builtin.OptimizeMode, |
| ... | @@ -38,8 +38,8 @@ pub fn create(owner: *std.Build, options: Options) *TranslateC { | ... | @@ -38,8 +38,8 @@ pub fn create(owner: *std.Build, options: Options) *TranslateC { |
| 38 | .makeFn = make, | 38 | .makeFn = make, |
| 39 | }), | 39 | }), |
| 40 | .source = source, | 40 | .source = source, |
| 41 | .include_dirs = std.ArrayList(std.Build.Module.IncludeDir).init(owner.allocator), | 41 | .include_dirs = std.array_list.Managed(std.Build.Module.IncludeDir).init(owner.allocator), |
| 42 | .c_macros = std.ArrayList([]const u8).init(owner.allocator), | 42 | .c_macros = std.array_list.Managed([]const u8).init(owner.allocator), |
| 43 | .out_basename = undefined, | 43 | .out_basename = undefined, |
| 44 | .target = options.target, | 44 | .target = options.target, |
| 45 | .optimize = options.optimize, | 45 | .optimize = options.optimize, |
| ... | @@ -153,7 +153,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { | ... | @@ -153,7 +153,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 153 | const b = step.owner; | 153 | const b = step.owner; |
| 154 | const translate_c: *TranslateC = @fieldParentPtr("step", step); | 154 | const translate_c: *TranslateC = @fieldParentPtr("step", step); |
| 155 | 155 | ||
| 156 | var argv_list = std.ArrayList([]const u8).init(b.allocator); | 156 | var argv_list = std.array_list.Managed([]const u8).init(b.allocator); |
| 157 | try argv_list.append(b.graph.zig_exe); | 157 | try argv_list.append(b.graph.zig_exe); |
| 158 | try argv_list.append("translate-c"); | 158 | try argv_list.append("translate-c"); |
| 159 | if (translate_c.link_libc) { | 159 | if (translate_c.link_libc) { |
lib/std/Io.zig+3-3| ... | @@ -117,7 +117,7 @@ pub fn GenericReader( | ... | @@ -117,7 +117,7 @@ pub fn GenericReader( |
| 117 | 117 | ||
| 118 | pub inline fn readAllArrayList( | 118 | pub inline fn readAllArrayList( |
| 119 | self: Self, | 119 | self: Self, |
| 120 | array_list: *std.ArrayList(u8), | 120 | array_list: *std.array_list.Managed(u8), |
| 121 | max_append_size: usize, | 121 | max_append_size: usize, |
| 122 | ) (error{StreamTooLong} || Allocator.Error || Error)!void { | 122 | ) (error{StreamTooLong} || Allocator.Error || Error)!void { |
| 123 | return @errorCast(self.any().readAllArrayList(array_list, max_append_size)); | 123 | return @errorCast(self.any().readAllArrayList(array_list, max_append_size)); |
| ... | @@ -126,7 +126,7 @@ pub fn GenericReader( | ... | @@ -126,7 +126,7 @@ pub fn GenericReader( |
| 126 | pub inline fn readAllArrayListAligned( | 126 | pub inline fn readAllArrayListAligned( |
| 127 | self: Self, | 127 | self: Self, |
| 128 | comptime alignment: ?Alignment, | 128 | comptime alignment: ?Alignment, |
| 129 | array_list: *std.ArrayListAligned(u8, alignment), | 129 | array_list: *std.array_list.AlignedManaged(u8, alignment), |
| 130 | max_append_size: usize, | 130 | max_append_size: usize, |
| 131 | ) (error{StreamTooLong} || Allocator.Error || Error)!void { | 131 | ) (error{StreamTooLong} || Allocator.Error || Error)!void { |
| 132 | return @errorCast(self.any().readAllArrayListAligned( | 132 | return @errorCast(self.any().readAllArrayListAligned( |
| ... | @@ -146,7 +146,7 @@ pub fn GenericReader( | ... | @@ -146,7 +146,7 @@ pub fn GenericReader( |
| 146 | 146 | ||
| 147 | pub inline fn readUntilDelimiterArrayList( | 147 | pub inline fn readUntilDelimiterArrayList( |
| 148 | self: Self, | 148 | self: Self, |
| 149 | array_list: *std.ArrayList(u8), | 149 | array_list: *std.array_list.Managed(u8), |
| 150 | delimiter: u8, | 150 | delimiter: u8, |
| 151 | max_size: usize, | 151 | max_size: usize, |
| 152 | ) (NoEofError || Allocator.Error || error{StreamTooLong})!void { | 152 | ) (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 { | ... | @@ -39,14 +39,14 @@ pub fn readNoEof(self: Self, buf: []u8) anyerror!void { |
| 39 | if (amt_read < buf.len) return error.EndOfStream; | 39 | if (amt_read < buf.len) return error.EndOfStream; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 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 |
| 43 | /// until end of stream is found. | 43 | /// until end of stream is found. |
| 44 | /// If the number of bytes appended would exceed `max_append_size`, | 44 | /// If the number of bytes appended would exceed `max_append_size`, |
| 45 | /// `error.StreamTooLong` is returned | 45 | /// `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. |
| 47 | pub fn readAllArrayList( | 47 | pub fn readAllArrayList( |
| 48 | self: Self, | 48 | self: Self, |
| 49 | array_list: *std.ArrayList(u8), | 49 | array_list: *std.array_list.Managed(u8), |
| 50 | max_append_size: usize, | 50 | max_append_size: usize, |
| 51 | ) anyerror!void { | 51 | ) anyerror!void { |
| 52 | return self.readAllArrayListAligned(null, array_list, max_append_size); | 52 | return self.readAllArrayListAligned(null, array_list, max_append_size); |
| ... | @@ -55,7 +55,7 @@ pub fn readAllArrayList( | ... | @@ -55,7 +55,7 @@ pub fn readAllArrayList( |
| 55 | pub fn readAllArrayListAligned( | 55 | pub fn readAllArrayListAligned( |
| 56 | self: Self, | 56 | self: Self, |
| 57 | comptime alignment: ?Alignment, | 57 | comptime alignment: ?Alignment, |
| 58 | array_list: *std.ArrayListAligned(u8, alignment), | 58 | array_list: *std.array_list.AlignedManaged(u8, alignment), |
| 59 | max_append_size: usize, | 59 | max_append_size: usize, |
| 60 | ) anyerror!void { | 60 | ) anyerror!void { |
| 61 | try array_list.ensureTotalCapacity(@min(max_append_size, 4096)); | 61 | try array_list.ensureTotalCapacity(@min(max_append_size, 4096)); |
| ... | @@ -87,20 +87,20 @@ pub fn readAllArrayListAligned( | ... | @@ -87,20 +87,20 @@ pub fn readAllArrayListAligned( |
| 87 | /// Caller owns returned memory. | 87 | /// Caller owns returned memory. |
| 88 | /// If this function returns an error, the contents from the stream read so far are lost. | 88 | /// If this function returns an error, the contents from the stream read so far are lost. |
| 89 | pub fn readAllAlloc(self: Self, allocator: mem.Allocator, max_size: usize) anyerror![]u8 { | 89 | pub 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); |
| 91 | defer array_list.deinit(); | 91 | defer array_list.deinit(); |
| 92 | try self.readAllArrayList(&array_list, max_size); | 92 | try self.readAllArrayList(&array_list, max_size); |
| 93 | return try array_list.toOwnedSlice(); | 93 | return try array_list.toOwnedSlice(); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | /// Deprecated: use `streamUntilDelimiter` with ArrayList's writer instead. | 96 | /// 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. |
| 98 | /// Does not include the delimiter in the result. | 98 | /// Does not include the delimiter in the result. |
| 99 | /// If the `std.ArrayList` length would exceed `max_size`, `error.StreamTooLong` is returned and the | 99 | /// If the `std.array_list.Managed` length would exceed `max_size`, `error.StreamTooLong` is returned and the |
| 100 | /// `std.ArrayList` is populated with `max_size` bytes from the stream. | 100 | /// `std.array_list.Managed` is populated with `max_size` bytes from the stream. |
| 101 | pub fn readUntilDelimiterArrayList( | 101 | pub fn readUntilDelimiterArrayList( |
| 102 | self: Self, | 102 | self: Self, |
| 103 | array_list: *std.ArrayList(u8), | 103 | array_list: *std.array_list.Managed(u8), |
| 104 | delimiter: u8, | 104 | delimiter: u8, |
| 105 | max_size: usize, | 105 | max_size: usize, |
| 106 | ) anyerror!void { | 106 | ) anyerror!void { |
| ... | @@ -119,7 +119,7 @@ pub fn readUntilDelimiterAlloc( | ... | @@ -119,7 +119,7 @@ pub fn readUntilDelimiterAlloc( |
| 119 | delimiter: u8, | 119 | delimiter: u8, |
| 120 | max_size: usize, | 120 | max_size: usize, |
| 121 | ) anyerror![]u8 { | 121 | ) anyerror![]u8 { |
| 122 | var array_list = std.ArrayList(u8).init(allocator); | 122 | var array_list = std.array_list.Managed(u8).init(allocator); |
| 123 | defer array_list.deinit(); | 123 | defer array_list.deinit(); |
| 124 | try self.streamUntilDelimiter(array_list.writer(), delimiter, max_size); | 124 | try self.streamUntilDelimiter(array_list.writer(), delimiter, max_size); |
| 125 | return try array_list.toOwnedSlice(); | 125 | return try array_list.toOwnedSlice(); |
| ... | @@ -154,7 +154,7 @@ pub fn readUntilDelimiterOrEofAlloc( | ... | @@ -154,7 +154,7 @@ pub fn readUntilDelimiterOrEofAlloc( |
| 154 | delimiter: u8, | 154 | delimiter: u8, |
| 155 | max_size: usize, | 155 | max_size: usize, |
| 156 | ) anyerror!?[]u8 { | 156 | ) anyerror!?[]u8 { |
| 157 | var array_list = std.ArrayList(u8).init(allocator); | 157 | var array_list = std.array_list.Managed(u8).init(allocator); |
| 158 | defer array_list.deinit(); | 158 | defer array_list.deinit(); |
| 159 | self.streamUntilDelimiter(array_list.writer(), delimiter, max_size) catch |err| switch (err) { | 159 | self.streamUntilDelimiter(array_list.writer(), delimiter, max_size) catch |err| switch (err) { |
| 160 | error.EndOfStream => if (array_list.items.len == 0) { | 160 | error.EndOfStream => if (array_list.items.len == 0) { |
lib/std/Io/Reader/test.zig+4-4| ... | @@ -34,7 +34,7 @@ test "skipBytes" { | ... | @@ -34,7 +34,7 @@ test "skipBytes" { |
| 34 | 34 | ||
| 35 | test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the delimiter, then EndOfStream" { | 35 | test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the delimiter, then EndOfStream" { |
| 36 | const a = std.testing.allocator; | 36 | const a = std.testing.allocator; |
| 37 | var list = std.ArrayList(u8).init(a); | 37 | var list = std.array_list.Managed(u8).init(a); |
| 38 | defer list.deinit(); | 38 | defer list.deinit(); |
| 39 | 39 | ||
| 40 | var fis = std.io.fixedBufferStream("0000\n1234\n"); | 40 | var fis = std.io.fixedBufferStream("0000\n1234\n"); |
| ... | @@ -49,7 +49,7 @@ test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the d | ... | @@ -49,7 +49,7 @@ test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the d |
| 49 | 49 | ||
| 50 | test "readUntilDelimiterArrayList returns an empty ArrayList" { | 50 | test "readUntilDelimiterArrayList returns an empty ArrayList" { |
| 51 | const a = std.testing.allocator; | 51 | const a = std.testing.allocator; |
| 52 | var list = std.ArrayList(u8).init(a); | 52 | var list = std.array_list.Managed(u8).init(a); |
| 53 | defer list.deinit(); | 53 | defer list.deinit(); |
| 54 | 54 | ||
| 55 | var fis = std.io.fixedBufferStream("\n"); | 55 | var fis = std.io.fixedBufferStream("\n"); |
| ... | @@ -61,7 +61,7 @@ test "readUntilDelimiterArrayList returns an empty ArrayList" { | ... | @@ -61,7 +61,7 @@ test "readUntilDelimiterArrayList returns an empty ArrayList" { |
| 61 | 61 | ||
| 62 | test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { | 62 | test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { |
| 63 | const a = std.testing.allocator; | 63 | const a = std.testing.allocator; |
| 64 | var list = std.ArrayList(u8).init(a); | 64 | var list = std.array_list.Managed(u8).init(a); |
| 65 | defer list.deinit(); | 65 | defer list.deinit(); |
| 66 | 66 | ||
| 67 | var fis = std.io.fixedBufferStream("1234567\n"); | 67 | var fis = std.io.fixedBufferStream("1234567\n"); |
| ... | @@ -75,7 +75,7 @@ test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with | ... | @@ -75,7 +75,7 @@ test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with |
| 75 | 75 | ||
| 76 | test "readUntilDelimiterArrayList returns EndOfStream" { | 76 | test "readUntilDelimiterArrayList returns EndOfStream" { |
| 77 | const a = std.testing.allocator; | 77 | const a = std.testing.allocator; |
| 78 | var list = std.ArrayList(u8).init(a); | 78 | var list = std.array_list.Managed(u8).init(a); |
| 79 | defer list.deinit(); | 79 | defer list.deinit(); |
| 80 | 80 | ||
| 81 | var fis = std.io.fixedBufferStream("1234"); | 81 | var fis = std.io.fixedBufferStream("1234"); |
lib/std/Target/Query.zig+13-12| ... | @@ -3,6 +3,15 @@ | ... | @@ -3,6 +3,15 @@ |
| 3 | //! provide meaningful and unsurprising defaults. This struct does reference | 3 | //! provide meaningful and unsurprising defaults. This struct does reference |
| 4 | //! any resources and it is copyable. | 4 | //! any resources and it is copyable. |
| 5 | 5 | ||
| 6 | const Query = @This(); | ||
| 7 | const std = @import("../std.zig"); | ||
| 8 | const builtin = @import("builtin"); | ||
| 9 | const assert = std.debug.assert; | ||
| 10 | const Target = std.Target; | ||
| 11 | const mem = std.mem; | ||
| 12 | const Allocator = std.mem.Allocator; | ||
| 13 | const ArrayList = std.ArrayList; | ||
| 14 | |||
| 6 | /// `null` means native. | 15 | /// `null` means native. |
| 7 | cpu_arch: ?Target.Cpu.Arch = null, | 16 | cpu_arch: ?Target.Cpu.Arch = null, |
| 8 | 17 | ||
| ... | @@ -394,7 +403,7 @@ pub fn canDetectLibC(self: Query) bool { | ... | @@ -394,7 +403,7 @@ pub fn canDetectLibC(self: Query) bool { |
| 394 | 403 | ||
| 395 | /// Formats a version with the patch component omitted if it is zero, | 404 | /// Formats a version with the patch component omitted if it is zero, |
| 396 | /// unlike SemanticVersion.format which formats all its version components regardless. | 405 | /// unlike SemanticVersion.format which formats all its version components regardless. |
| 397 | fn formatVersion(version: SemanticVersion, gpa: Allocator, list: *std.ArrayListUnmanaged(u8)) !void { | 406 | fn formatVersion(version: SemanticVersion, gpa: Allocator, list: *ArrayList(u8)) !void { |
| 398 | if (version.patch == 0) { | 407 | if (version.patch == 0) { |
| 399 | try list.print(gpa, "{d}.{d}", .{ version.major, version.minor }); | 408 | try list.print(gpa, "{d}.{d}", .{ version.major, version.minor }); |
| 400 | } else { | 409 | } else { |
| ... | @@ -408,7 +417,7 @@ pub fn zigTriple(self: Query, gpa: Allocator) Allocator.Error![]u8 { | ... | @@ -408,7 +417,7 @@ pub fn zigTriple(self: Query, gpa: Allocator) Allocator.Error![]u8 { |
| 408 | const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native"; | 417 | const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native"; |
| 409 | const os_name = if (self.os_tag) |os_tag| @tagName(os_tag) else "native"; | 418 | const os_name = if (self.os_tag) |os_tag| @tagName(os_tag) else "native"; |
| 410 | 419 | ||
| 411 | var result: std.ArrayListUnmanaged(u8) = .empty; | 420 | var result: ArrayList(u8) = .empty; |
| 412 | defer result.deinit(gpa); | 421 | defer result.deinit(gpa); |
| 413 | 422 | ||
| 414 | try result.print(gpa, "{s}-{s}", .{ arch_name, os_name }); | 423 | try result.print(gpa, "{s}-{s}", .{ arch_name, os_name }); |
| ... | @@ -469,7 +478,7 @@ pub fn zigTriple(self: Query, gpa: Allocator) Allocator.Error![]u8 { | ... | @@ -469,7 +478,7 @@ pub fn zigTriple(self: Query, gpa: Allocator) Allocator.Error![]u8 { |
| 469 | /// Renders the query into a textual representation that can be parsed via the | 478 | /// Renders the query into a textual representation that can be parsed via the |
| 470 | /// `-mcpu` flag passed to the Zig compiler. | 479 | /// `-mcpu` flag passed to the Zig compiler. |
| 471 | /// Appends the result to `buffer`. | 480 | /// Appends the result to `buffer`. |
| 472 | pub fn serializeCpu(q: Query, buffer: *std.ArrayList(u8)) Allocator.Error!void { | 481 | pub fn serializeCpu(q: Query, buffer: *std.array_list.Managed(u8)) Allocator.Error!void { |
| 473 | try buffer.ensureUnusedCapacity(8); | 482 | try buffer.ensureUnusedCapacity(8); |
| 474 | switch (q.cpu_model) { | 483 | switch (q.cpu_model) { |
| 475 | .native => { | 484 | .native => { |
| ... | @@ -512,7 +521,7 @@ pub fn serializeCpu(q: Query, buffer: *std.ArrayList(u8)) Allocator.Error!void { | ... | @@ -512,7 +521,7 @@ pub fn serializeCpu(q: Query, buffer: *std.ArrayList(u8)) Allocator.Error!void { |
| 512 | } | 521 | } |
| 513 | 522 | ||
| 514 | pub fn serializeCpuAlloc(q: Query, ally: Allocator) Allocator.Error![]u8 { | 523 | pub 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); |
| 516 | try serializeCpu(q, &buffer); | 525 | try serializeCpu(q, &buffer); |
| 517 | return buffer.toOwnedSlice(); | 526 | return buffer.toOwnedSlice(); |
| 518 | } | 527 | } |
| ... | @@ -596,14 +605,6 @@ fn versionEqualOpt(a: ?SemanticVersion, b: ?SemanticVersion) bool { | ... | @@ -596,14 +605,6 @@ fn versionEqualOpt(a: ?SemanticVersion, b: ?SemanticVersion) bool { |
| 596 | return SemanticVersion.order(a.?, b.?) == .eq; | 605 | return SemanticVersion.order(a.?, b.?) == .eq; |
| 597 | } | 606 | } |
| 598 | 607 | ||
| 599 | const Query = @This(); | ||
| 600 | const std = @import("../std.zig"); | ||
| 601 | const builtin = @import("builtin"); | ||
| 602 | const assert = std.debug.assert; | ||
| 603 | const Target = std.Target; | ||
| 604 | const mem = std.mem; | ||
| 605 | const Allocator = std.mem.Allocator; | ||
| 606 | |||
| 607 | test parse { | 608 | test parse { |
| 608 | if (builtin.target.isGnuLibC()) { | 609 | if (builtin.target.isGnuLibC()) { |
| 609 | var query = try Query.parse(.{}); | 610 | var query = try Query.parse(.{}); |
lib/std/array_list.zig+103-120| ... | @@ -5,27 +5,18 @@ const testing = std.testing; | ... | @@ -5,27 +5,18 @@ const testing = std.testing; |
| 5 | const mem = std.mem; | 5 | const mem = std.mem; |
| 6 | const math = std.math; | 6 | const math = std.math; |
| 7 | const Allocator = mem.Allocator; | 7 | const Allocator = mem.Allocator; |
| 8 | const ArrayList = std.ArrayList; | ||
| 8 | 9 | ||
| 9 | /// A contiguous, growable list of items in memory. | 10 | /// Deprecated. |
| 10 | /// This is a wrapper around an array of T values. Initialize with `init`. | 11 | pub fn Managed(comptime T: type) type { |
| 11 | /// | 12 | return AlignedManaged(T, null); |
| 12 | /// This struct internally stores a `std.mem.Allocator` for memory management. | ||
| 13 | /// To manually specify an allocator with each function call see `ArrayListUnmanaged`. | ||
| 14 | pub fn ArrayList(comptime T: type) type { | ||
| 15 | return ArrayListAligned(T, null); | ||
| 16 | } | 13 | } |
| 17 | 14 | ||
| 18 | /// A contiguous, growable list of arbitrarily aligned items in memory. | 15 | /// Deprecated. |
| 19 | /// This is a wrapper around an array of T values aligned to `alignment`-byte | 16 | pub fn AlignedManaged(comptime T: type, comptime alignment: ?mem.Alignment) type { |
| 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`. | ||
| 25 | pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) type { | ||
| 26 | if (alignment) |a| { | 17 | if (alignment) |a| { |
| 27 | if (a.toByteUnits() == @alignOf(T)) { | 18 | if (a.toByteUnits() == @alignOf(T)) { |
| 28 | return ArrayListAligned(T, null); | 19 | return AlignedManaged(T, null); |
| 29 | } | 20 | } |
| 30 | } | 21 | } |
| 31 | return struct { | 22 | return struct { |
| ... | @@ -96,11 +87,11 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty | ... | @@ -96,11 +87,11 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty |
| 96 | }; | 87 | }; |
| 97 | } | 88 | } |
| 98 | 89 | ||
| 99 | /// Initializes an ArrayListUnmanaged with the `items` and `capacity` fields | 90 | /// Initializes an ArrayList with the `items` and `capacity` fields |
| 100 | /// of this ArrayList. Empties this ArrayList. | 91 | /// of this ArrayList. Empties this ArrayList. |
| 101 | pub fn moveToUnmanaged(self: *Self) ArrayListAlignedUnmanaged(T, alignment) { | 92 | pub fn moveToUnmanaged(self: *Self) Aligned(T, alignment) { |
| 102 | const allocator = self.allocator; | 93 | 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 }; |
| 104 | self.* = init(allocator); | 95 | self.* = init(allocator); |
| 105 | return result; | 96 | return result; |
| 106 | } | 97 | } |
| ... | @@ -181,7 +172,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty | ... | @@ -181,7 +172,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty |
| 181 | // a new buffer and doing our own copy. With a realloc() call, | 172 | // a new buffer and doing our own copy. With a realloc() call, |
| 182 | // the allocator implementation would pointlessly copy our | 173 | // the allocator implementation would pointlessly copy our |
| 183 | // extra capacity. | 174 | // 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); |
| 185 | const old_memory = self.allocatedSlice(); | 176 | const old_memory = self.allocatedSlice(); |
| 186 | if (self.allocator.remap(old_memory, new_capacity)) |new_memory| { | 177 | if (self.allocator.remap(old_memory, new_capacity)) |new_memory| { |
| 187 | self.items.ptr = new_memory.ptr; | 178 | self.items.ptr = new_memory.ptr; |
| ... | @@ -449,7 +440,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty | ... | @@ -449,7 +440,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty |
| 449 | 440 | ||
| 450 | if (self.capacity >= new_capacity) return; | 441 | if (self.capacity >= new_capacity) return; |
| 451 | 442 | ||
| 452 | const better_capacity = ArrayListAlignedUnmanaged(T, alignment).growCapacity(self.capacity, new_capacity); | 443 | const better_capacity = Aligned(T, alignment).growCapacity(self.capacity, new_capacity); |
| 453 | return self.ensureTotalCapacityPrecise(better_capacity); | 444 | return self.ensureTotalCapacityPrecise(better_capacity); |
| 454 | } | 445 | } |
| 455 | 446 | ||
| ... | @@ -597,14 +588,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty | ... | @@ -597,14 +588,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?mem.Alignment) ty |
| 597 | }; | 588 | }; |
| 598 | } | 589 | } |
| 599 | 590 | ||
| 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`. | ||
| 604 | pub fn ArrayListUnmanaged(comptime T: type) type { | ||
| 605 | return ArrayListAlignedUnmanaged(T, null); | ||
| 606 | } | ||
| 607 | |||
| 608 | /// A contiguous, growable list of arbitrarily aligned items in memory. | 591 | /// A contiguous, growable list of arbitrarily aligned items in memory. |
| 609 | /// This is a wrapper around an array of T values aligned to `alignment`-byte | 592 | /// This is a wrapper around an array of T values aligned to `alignment`-byte |
| 610 | /// addresses. If the specified alignment is `null`, then `@alignOf(T)` is used. | 593 | /// addresses. If the specified alignment is `null`, then `@alignOf(T)` is used. |
| ... | @@ -614,10 +597,10 @@ pub fn ArrayListUnmanaged(comptime T: type) type { | ... | @@ -614,10 +597,10 @@ pub fn ArrayListUnmanaged(comptime T: type) type { |
| 614 | /// or use `toOwnedSlice`. | 597 | /// or use `toOwnedSlice`. |
| 615 | /// | 598 | /// |
| 616 | /// Default initialization of this struct is deprecated; use `.empty` instead. | 599 | /// Default initialization of this struct is deprecated; use `.empty` instead. |
| 617 | pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alignment) type { | 600 | pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type { |
| 618 | if (alignment) |a| { | 601 | if (alignment) |a| { |
| 619 | if (a.toByteUnits() == @alignOf(T)) { | 602 | if (a.toByteUnits() == @alignOf(T)) { |
| 620 | return ArrayListAlignedUnmanaged(T, null); | 603 | return Aligned(T, null); |
| 621 | } | 604 | } |
| 622 | } | 605 | } |
| 623 | return struct { | 606 | return struct { |
| ... | @@ -675,11 +658,11 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alig | ... | @@ -675,11 +658,11 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alig |
| 675 | 658 | ||
| 676 | /// Convert this list into an analogous memory-managed one. | 659 | /// Convert this list into an analogous memory-managed one. |
| 677 | /// The returned list has ownership of the underlying memory. | 660 | /// 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) { |
| 679 | return .{ .items = self.items, .capacity = self.capacity, .allocator = gpa }; | 662 | return .{ .items = self.items, .capacity = self.capacity, .allocator = gpa }; |
| 680 | } | 663 | } |
| 681 | 664 | ||
| 682 | /// ArrayListUnmanaged takes ownership of the passed in slice. | 665 | /// ArrayList takes ownership of the passed in slice. |
| 683 | /// Deinitialize with `deinit` or use `toOwnedSlice`. | 666 | /// Deinitialize with `deinit` or use `toOwnedSlice`. |
| 684 | pub fn fromOwnedSlice(slice: Slice) Self { | 667 | pub fn fromOwnedSlice(slice: Slice) Self { |
| 685 | return Self{ | 668 | return Self{ |
| ... | @@ -688,7 +671,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alig | ... | @@ -688,7 +671,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?mem.Alig |
| 688 | }; | 671 | }; |
| 689 | } | 672 | } |
| 690 | 673 | ||
| 691 | /// ArrayListUnmanaged takes ownership of the passed in slice. | 674 | /// ArrayList takes ownership of the passed in slice. |
| 692 | /// Deinitialize with `deinit` or use `toOwnedSlice`. | 675 | /// Deinitialize with `deinit` or use `toOwnedSlice`. |
| 693 | pub fn fromOwnedSliceSentinel(comptime sentinel: T, slice: [:sentinel]T) Self { | 676 | pub fn fromOwnedSliceSentinel(comptime sentinel: T, slice: [:sentinel]T) Self { |
| 694 | return Self{ | 677 | return Self{ |
| ... | @@ -1444,7 +1427,7 @@ fn addOrOom(a: usize, b: usize) error{OutOfMemory}!usize { | ... | @@ -1444,7 +1427,7 @@ fn addOrOom(a: usize, b: usize) error{OutOfMemory}!usize { |
| 1444 | 1427 | ||
| 1445 | test "init" { | 1428 | test "init" { |
| 1446 | { | 1429 | { |
| 1447 | var list = ArrayList(i32).init(testing.allocator); | 1430 | var list = Managed(i32).init(testing.allocator); |
| 1448 | defer list.deinit(); | 1431 | defer list.deinit(); |
| 1449 | 1432 | ||
| 1450 | try testing.expect(list.items.len == 0); | 1433 | try testing.expect(list.items.len == 0); |
| ... | @@ -1452,7 +1435,7 @@ test "init" { | ... | @@ -1452,7 +1435,7 @@ test "init" { |
| 1452 | } | 1435 | } |
| 1453 | 1436 | ||
| 1454 | { | 1437 | { |
| 1455 | const list: ArrayListUnmanaged(i32) = .empty; | 1438 | const list: ArrayList(i32) = .empty; |
| 1456 | 1439 | ||
| 1457 | try testing.expect(list.items.len == 0); | 1440 | try testing.expect(list.items.len == 0); |
| 1458 | try testing.expect(list.capacity == 0); | 1441 | try testing.expect(list.capacity == 0); |
| ... | @@ -1462,13 +1445,13 @@ test "init" { | ... | @@ -1462,13 +1445,13 @@ test "init" { |
| 1462 | test "initCapacity" { | 1445 | test "initCapacity" { |
| 1463 | const a = testing.allocator; | 1446 | const a = testing.allocator; |
| 1464 | { | 1447 | { |
| 1465 | var list = try ArrayList(i8).initCapacity(a, 200); | 1448 | var list = try Managed(i8).initCapacity(a, 200); |
| 1466 | defer list.deinit(); | 1449 | defer list.deinit(); |
| 1467 | try testing.expect(list.items.len == 0); | 1450 | try testing.expect(list.items.len == 0); |
| 1468 | try testing.expect(list.capacity >= 200); | 1451 | try testing.expect(list.capacity >= 200); |
| 1469 | } | 1452 | } |
| 1470 | { | 1453 | { |
| 1471 | var list = try ArrayListUnmanaged(i8).initCapacity(a, 200); | 1454 | var list = try ArrayList(i8).initCapacity(a, 200); |
| 1472 | defer list.deinit(a); | 1455 | defer list.deinit(a); |
| 1473 | try testing.expect(list.items.len == 0); | 1456 | try testing.expect(list.items.len == 0); |
| 1474 | try testing.expect(list.capacity >= 200); | 1457 | try testing.expect(list.capacity >= 200); |
| ... | @@ -1478,7 +1461,7 @@ test "initCapacity" { | ... | @@ -1478,7 +1461,7 @@ test "initCapacity" { |
| 1478 | test "clone" { | 1461 | test "clone" { |
| 1479 | const a = testing.allocator; | 1462 | const a = testing.allocator; |
| 1480 | { | 1463 | { |
| 1481 | var array = ArrayList(i32).init(a); | 1464 | var array = Managed(i32).init(a); |
| 1482 | try array.append(-1); | 1465 | try array.append(-1); |
| 1483 | try array.append(3); | 1466 | try array.append(3); |
| 1484 | try array.append(5); | 1467 | try array.append(5); |
| ... | @@ -1497,7 +1480,7 @@ test "clone" { | ... | @@ -1497,7 +1480,7 @@ test "clone" { |
| 1497 | try testing.expectEqual(@as(i32, 5), cloned.items[2]); | 1480 | try testing.expectEqual(@as(i32, 5), cloned.items[2]); |
| 1498 | } | 1481 | } |
| 1499 | { | 1482 | { |
| 1500 | var array: ArrayListUnmanaged(i32) = .empty; | 1483 | var array: ArrayList(i32) = .empty; |
| 1501 | try array.append(a, -1); | 1484 | try array.append(a, -1); |
| 1502 | try array.append(a, 3); | 1485 | try array.append(a, 3); |
| 1503 | try array.append(a, 5); | 1486 | try array.append(a, 5); |
| ... | @@ -1519,7 +1502,7 @@ test "clone" { | ... | @@ -1519,7 +1502,7 @@ test "clone" { |
| 1519 | test "basic" { | 1502 | test "basic" { |
| 1520 | const a = testing.allocator; | 1503 | const a = testing.allocator; |
| 1521 | { | 1504 | { |
| 1522 | var list = ArrayList(i32).init(a); | 1505 | var list = Managed(i32).init(a); |
| 1523 | defer list.deinit(); | 1506 | defer list.deinit(); |
| 1524 | 1507 | ||
| 1525 | { | 1508 | { |
| ... | @@ -1569,7 +1552,7 @@ test "basic" { | ... | @@ -1569,7 +1552,7 @@ test "basic" { |
| 1569 | try testing.expect(list.pop() == 33); | 1552 | try testing.expect(list.pop() == 33); |
| 1570 | } | 1553 | } |
| 1571 | { | 1554 | { |
| 1572 | var list: ArrayListUnmanaged(i32) = .empty; | 1555 | var list: ArrayList(i32) = .empty; |
| 1573 | defer list.deinit(a); | 1556 | defer list.deinit(a); |
| 1574 | 1557 | ||
| 1575 | { | 1558 | { |
| ... | @@ -1623,7 +1606,7 @@ test "basic" { | ... | @@ -1623,7 +1606,7 @@ test "basic" { |
| 1623 | test "appendNTimes" { | 1606 | test "appendNTimes" { |
| 1624 | const a = testing.allocator; | 1607 | const a = testing.allocator; |
| 1625 | { | 1608 | { |
| 1626 | var list = ArrayList(i32).init(a); | 1609 | var list = Managed(i32).init(a); |
| 1627 | defer list.deinit(); | 1610 | defer list.deinit(); |
| 1628 | 1611 | ||
| 1629 | try list.appendNTimes(2, 10); | 1612 | try list.appendNTimes(2, 10); |
| ... | @@ -1633,7 +1616,7 @@ test "appendNTimes" { | ... | @@ -1633,7 +1616,7 @@ test "appendNTimes" { |
| 1633 | } | 1616 | } |
| 1634 | } | 1617 | } |
| 1635 | { | 1618 | { |
| 1636 | var list: ArrayListUnmanaged(i32) = .empty; | 1619 | var list: ArrayList(i32) = .empty; |
| 1637 | defer list.deinit(a); | 1620 | defer list.deinit(a); |
| 1638 | 1621 | ||
| 1639 | try list.appendNTimes(a, 2, 10); | 1622 | try list.appendNTimes(a, 2, 10); |
| ... | @@ -1647,12 +1630,12 @@ test "appendNTimes" { | ... | @@ -1647,12 +1630,12 @@ test "appendNTimes" { |
| 1647 | test "appendNTimes with failing allocator" { | 1630 | test "appendNTimes with failing allocator" { |
| 1648 | const a = testing.failing_allocator; | 1631 | const a = testing.failing_allocator; |
| 1649 | { | 1632 | { |
| 1650 | var list = ArrayList(i32).init(a); | 1633 | var list = Managed(i32).init(a); |
| 1651 | defer list.deinit(); | 1634 | defer list.deinit(); |
| 1652 | try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10)); | 1635 | try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10)); |
| 1653 | } | 1636 | } |
| 1654 | { | 1637 | { |
| 1655 | var list: ArrayListUnmanaged(i32) = .empty; | 1638 | var list: ArrayList(i32) = .empty; |
| 1656 | defer list.deinit(a); | 1639 | defer list.deinit(a); |
| 1657 | try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10)); | 1640 | try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10)); |
| 1658 | } | 1641 | } |
| ... | @@ -1661,7 +1644,7 @@ test "appendNTimes with failing allocator" { | ... | @@ -1661,7 +1644,7 @@ test "appendNTimes with failing allocator" { |
| 1661 | test "orderedRemove" { | 1644 | test "orderedRemove" { |
| 1662 | const a = testing.allocator; | 1645 | const a = testing.allocator; |
| 1663 | { | 1646 | { |
| 1664 | var list = ArrayList(i32).init(a); | 1647 | var list = Managed(i32).init(a); |
| 1665 | defer list.deinit(); | 1648 | defer list.deinit(); |
| 1666 | 1649 | ||
| 1667 | try list.append(1); | 1650 | try list.append(1); |
| ... | @@ -1687,7 +1670,7 @@ test "orderedRemove" { | ... | @@ -1687,7 +1670,7 @@ test "orderedRemove" { |
| 1687 | try testing.expectEqual(@as(usize, 4), list.items.len); | 1670 | try testing.expectEqual(@as(usize, 4), list.items.len); |
| 1688 | } | 1671 | } |
| 1689 | { | 1672 | { |
| 1690 | var list: ArrayListUnmanaged(i32) = .empty; | 1673 | var list: ArrayList(i32) = .empty; |
| 1691 | defer list.deinit(a); | 1674 | defer list.deinit(a); |
| 1692 | 1675 | ||
| 1693 | try list.append(a, 1); | 1676 | try list.append(a, 1); |
| ... | @@ -1714,7 +1697,7 @@ test "orderedRemove" { | ... | @@ -1714,7 +1697,7 @@ test "orderedRemove" { |
| 1714 | } | 1697 | } |
| 1715 | { | 1698 | { |
| 1716 | // remove last item | 1699 | // remove last item |
| 1717 | var list = ArrayList(i32).init(a); | 1700 | var list = Managed(i32).init(a); |
| 1718 | defer list.deinit(); | 1701 | defer list.deinit(); |
| 1719 | try list.append(1); | 1702 | try list.append(1); |
| 1720 | try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); | 1703 | try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); |
| ... | @@ -1722,7 +1705,7 @@ test "orderedRemove" { | ... | @@ -1722,7 +1705,7 @@ test "orderedRemove" { |
| 1722 | } | 1705 | } |
| 1723 | { | 1706 | { |
| 1724 | // remove last item | 1707 | // remove last item |
| 1725 | var list: ArrayListUnmanaged(i32) = .empty; | 1708 | var list: ArrayList(i32) = .empty; |
| 1726 | defer list.deinit(a); | 1709 | defer list.deinit(a); |
| 1727 | try list.append(a, 1); | 1710 | try list.append(a, 1); |
| 1728 | try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); | 1711 | try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); |
| ... | @@ -1733,7 +1716,7 @@ test "orderedRemove" { | ... | @@ -1733,7 +1716,7 @@ test "orderedRemove" { |
| 1733 | test "swapRemove" { | 1716 | test "swapRemove" { |
| 1734 | const a = testing.allocator; | 1717 | const a = testing.allocator; |
| 1735 | { | 1718 | { |
| 1736 | var list = ArrayList(i32).init(a); | 1719 | var list = Managed(i32).init(a); |
| 1737 | defer list.deinit(); | 1720 | defer list.deinit(); |
| 1738 | 1721 | ||
| 1739 | try list.append(1); | 1722 | try list.append(1); |
| ... | @@ -1759,7 +1742,7 @@ test "swapRemove" { | ... | @@ -1759,7 +1742,7 @@ test "swapRemove" { |
| 1759 | try testing.expect(list.items.len == 4); | 1742 | try testing.expect(list.items.len == 4); |
| 1760 | } | 1743 | } |
| 1761 | { | 1744 | { |
| 1762 | var list: ArrayListUnmanaged(i32) = .empty; | 1745 | var list: ArrayList(i32) = .empty; |
| 1763 | defer list.deinit(a); | 1746 | defer list.deinit(a); |
| 1764 | 1747 | ||
| 1765 | try list.append(a, 1); | 1748 | try list.append(a, 1); |
| ... | @@ -1789,7 +1772,7 @@ test "swapRemove" { | ... | @@ -1789,7 +1772,7 @@ test "swapRemove" { |
| 1789 | test "insert" { | 1772 | test "insert" { |
| 1790 | const a = testing.allocator; | 1773 | const a = testing.allocator; |
| 1791 | { | 1774 | { |
| 1792 | var list = ArrayList(i32).init(a); | 1775 | var list = Managed(i32).init(a); |
| 1793 | defer list.deinit(); | 1776 | defer list.deinit(); |
| 1794 | 1777 | ||
| 1795 | try list.insert(0, 1); | 1778 | try list.insert(0, 1); |
| ... | @@ -1802,7 +1785,7 @@ test "insert" { | ... | @@ -1802,7 +1785,7 @@ test "insert" { |
| 1802 | try testing.expect(list.items[3] == 3); | 1785 | try testing.expect(list.items[3] == 3); |
| 1803 | } | 1786 | } |
| 1804 | { | 1787 | { |
| 1805 | var list: ArrayListUnmanaged(i32) = .empty; | 1788 | var list: ArrayList(i32) = .empty; |
| 1806 | defer list.deinit(a); | 1789 | defer list.deinit(a); |
| 1807 | 1790 | ||
| 1808 | try list.insert(a, 0, 1); | 1791 | try list.insert(a, 0, 1); |
| ... | @@ -1819,7 +1802,7 @@ test "insert" { | ... | @@ -1819,7 +1802,7 @@ test "insert" { |
| 1819 | test "insertSlice" { | 1802 | test "insertSlice" { |
| 1820 | const a = testing.allocator; | 1803 | const a = testing.allocator; |
| 1821 | { | 1804 | { |
| 1822 | var list = ArrayList(i32).init(a); | 1805 | var list = Managed(i32).init(a); |
| 1823 | defer list.deinit(); | 1806 | defer list.deinit(); |
| 1824 | 1807 | ||
| 1825 | try list.append(1); | 1808 | try list.append(1); |
| ... | @@ -1840,7 +1823,7 @@ test "insertSlice" { | ... | @@ -1840,7 +1823,7 @@ test "insertSlice" { |
| 1840 | try testing.expect(list.items[0] == 1); | 1823 | try testing.expect(list.items[0] == 1); |
| 1841 | } | 1824 | } |
| 1842 | { | 1825 | { |
| 1843 | var list: ArrayListUnmanaged(i32) = .empty; | 1826 | var list: ArrayList(i32) = .empty; |
| 1844 | defer list.deinit(a); | 1827 | defer list.deinit(a); |
| 1845 | 1828 | ||
| 1846 | try list.append(a, 1); | 1829 | try list.append(a, 1); |
| ... | @@ -1862,11 +1845,11 @@ test "insertSlice" { | ... | @@ -1862,11 +1845,11 @@ test "insertSlice" { |
| 1862 | } | 1845 | } |
| 1863 | } | 1846 | } |
| 1864 | 1847 | ||
| 1865 | test "ArrayList.replaceRange" { | 1848 | test "Managed.replaceRange" { |
| 1866 | const a = testing.allocator; | 1849 | const a = testing.allocator; |
| 1867 | 1850 | ||
| 1868 | { | 1851 | { |
| 1869 | var list = ArrayList(i32).init(a); | 1852 | var list = Managed(i32).init(a); |
| 1870 | defer list.deinit(); | 1853 | defer list.deinit(); |
| 1871 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1854 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1872 | 1855 | ||
| ... | @@ -1875,7 +1858,7 @@ test "ArrayList.replaceRange" { | ... | @@ -1875,7 +1858,7 @@ test "ArrayList.replaceRange" { |
| 1875 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); | 1858 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); |
| 1876 | } | 1859 | } |
| 1877 | { | 1860 | { |
| 1878 | var list = ArrayList(i32).init(a); | 1861 | var list = Managed(i32).init(a); |
| 1879 | defer list.deinit(); | 1862 | defer list.deinit(); |
| 1880 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1863 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1881 | 1864 | ||
| ... | @@ -1888,7 +1871,7 @@ test "ArrayList.replaceRange" { | ... | @@ -1888,7 +1871,7 @@ test "ArrayList.replaceRange" { |
| 1888 | ); | 1871 | ); |
| 1889 | } | 1872 | } |
| 1890 | { | 1873 | { |
| 1891 | var list = ArrayList(i32).init(a); | 1874 | var list = Managed(i32).init(a); |
| 1892 | defer list.deinit(); | 1875 | defer list.deinit(); |
| 1893 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1876 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1894 | 1877 | ||
| ... | @@ -1897,7 +1880,7 @@ test "ArrayList.replaceRange" { | ... | @@ -1897,7 +1880,7 @@ test "ArrayList.replaceRange" { |
| 1897 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); | 1880 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); |
| 1898 | } | 1881 | } |
| 1899 | { | 1882 | { |
| 1900 | var list = ArrayList(i32).init(a); | 1883 | var list = Managed(i32).init(a); |
| 1901 | defer list.deinit(); | 1884 | defer list.deinit(); |
| 1902 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1885 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1903 | 1886 | ||
| ... | @@ -1906,7 +1889,7 @@ test "ArrayList.replaceRange" { | ... | @@ -1906,7 +1889,7 @@ test "ArrayList.replaceRange" { |
| 1906 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); | 1889 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); |
| 1907 | } | 1890 | } |
| 1908 | { | 1891 | { |
| 1909 | var list = ArrayList(i32).init(a); | 1892 | var list = Managed(i32).init(a); |
| 1910 | defer list.deinit(); | 1893 | defer list.deinit(); |
| 1911 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1894 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1912 | 1895 | ||
| ... | @@ -1916,11 +1899,11 @@ test "ArrayList.replaceRange" { | ... | @@ -1916,11 +1899,11 @@ test "ArrayList.replaceRange" { |
| 1916 | } | 1899 | } |
| 1917 | } | 1900 | } |
| 1918 | 1901 | ||
| 1919 | test "ArrayList.replaceRangeAssumeCapacity" { | 1902 | test "Managed.replaceRangeAssumeCapacity" { |
| 1920 | const a = testing.allocator; | 1903 | const a = testing.allocator; |
| 1921 | 1904 | ||
| 1922 | { | 1905 | { |
| 1923 | var list = ArrayList(i32).init(a); | 1906 | var list = Managed(i32).init(a); |
| 1924 | defer list.deinit(); | 1907 | defer list.deinit(); |
| 1925 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1908 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1926 | 1909 | ||
| ... | @@ -1929,7 +1912,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { | ... | @@ -1929,7 +1912,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { |
| 1929 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); | 1912 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); |
| 1930 | } | 1913 | } |
| 1931 | { | 1914 | { |
| 1932 | var list = ArrayList(i32).init(a); | 1915 | var list = Managed(i32).init(a); |
| 1933 | defer list.deinit(); | 1916 | defer list.deinit(); |
| 1934 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1917 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1935 | 1918 | ||
| ... | @@ -1942,7 +1925,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { | ... | @@ -1942,7 +1925,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { |
| 1942 | ); | 1925 | ); |
| 1943 | } | 1926 | } |
| 1944 | { | 1927 | { |
| 1945 | var list = ArrayList(i32).init(a); | 1928 | var list = Managed(i32).init(a); |
| 1946 | defer list.deinit(); | 1929 | defer list.deinit(); |
| 1947 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1930 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1948 | 1931 | ||
| ... | @@ -1951,7 +1934,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { | ... | @@ -1951,7 +1934,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { |
| 1951 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); | 1934 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); |
| 1952 | } | 1935 | } |
| 1953 | { | 1936 | { |
| 1954 | var list = ArrayList(i32).init(a); | 1937 | var list = Managed(i32).init(a); |
| 1955 | defer list.deinit(); | 1938 | defer list.deinit(); |
| 1956 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1939 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1957 | 1940 | ||
| ... | @@ -1960,7 +1943,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { | ... | @@ -1960,7 +1943,7 @@ test "ArrayList.replaceRangeAssumeCapacity" { |
| 1960 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); | 1943 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); |
| 1961 | } | 1944 | } |
| 1962 | { | 1945 | { |
| 1963 | var list = ArrayList(i32).init(a); | 1946 | var list = Managed(i32).init(a); |
| 1964 | defer list.deinit(); | 1947 | defer list.deinit(); |
| 1965 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); | 1948 | try list.appendSlice(&[_]i32{ 1, 2, 3, 4, 5 }); |
| 1966 | 1949 | ||
| ... | @@ -1970,11 +1953,11 @@ test "ArrayList.replaceRangeAssumeCapacity" { | ... | @@ -1970,11 +1953,11 @@ test "ArrayList.replaceRangeAssumeCapacity" { |
| 1970 | } | 1953 | } |
| 1971 | } | 1954 | } |
| 1972 | 1955 | ||
| 1973 | test "ArrayListUnmanaged.replaceRange" { | 1956 | test "ArrayList.replaceRange" { |
| 1974 | const a = testing.allocator; | 1957 | const a = testing.allocator; |
| 1975 | 1958 | ||
| 1976 | { | 1959 | { |
| 1977 | var list: ArrayListUnmanaged(i32) = .empty; | 1960 | var list: ArrayList(i32) = .empty; |
| 1978 | defer list.deinit(a); | 1961 | defer list.deinit(a); |
| 1979 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1962 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1980 | 1963 | ||
| ... | @@ -1983,7 +1966,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1983,7 +1966,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1983 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); | 1966 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); |
| 1984 | } | 1967 | } |
| 1985 | { | 1968 | { |
| 1986 | var list: ArrayListUnmanaged(i32) = .empty; | 1969 | var list: ArrayList(i32) = .empty; |
| 1987 | defer list.deinit(a); | 1970 | defer list.deinit(a); |
| 1988 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1971 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1989 | 1972 | ||
| ... | @@ -1996,7 +1979,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1996,7 +1979,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1996 | ); | 1979 | ); |
| 1997 | } | 1980 | } |
| 1998 | { | 1981 | { |
| 1999 | var list: ArrayListUnmanaged(i32) = .empty; | 1982 | var list: ArrayList(i32) = .empty; |
| 2000 | defer list.deinit(a); | 1983 | defer list.deinit(a); |
| 2001 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1984 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2002 | 1985 | ||
| ... | @@ -2005,7 +1988,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -2005,7 +1988,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 2005 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); | 1988 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); |
| 2006 | } | 1989 | } |
| 2007 | { | 1990 | { |
| 2008 | var list: ArrayListUnmanaged(i32) = .empty; | 1991 | var list: ArrayList(i32) = .empty; |
| 2009 | defer list.deinit(a); | 1992 | defer list.deinit(a); |
| 2010 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1993 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2011 | 1994 | ||
| ... | @@ -2014,7 +1997,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -2014,7 +1997,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 2014 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); | 1997 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); |
| 2015 | } | 1998 | } |
| 2016 | { | 1999 | { |
| 2017 | var list: ArrayListUnmanaged(i32) = .empty; | 2000 | var list: ArrayList(i32) = .empty; |
| 2018 | defer list.deinit(a); | 2001 | defer list.deinit(a); |
| 2019 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 2002 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2020 | 2003 | ||
| ... | @@ -2024,11 +2007,11 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -2024,11 +2007,11 @@ test "ArrayListUnmanaged.replaceRange" { |
| 2024 | } | 2007 | } |
| 2025 | } | 2008 | } |
| 2026 | 2009 | ||
| 2027 | test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | 2010 | test "ArrayList.replaceRangeAssumeCapacity" { |
| 2028 | const a = testing.allocator; | 2011 | const a = testing.allocator; |
| 2029 | 2012 | ||
| 2030 | { | 2013 | { |
| 2031 | var list: ArrayListUnmanaged(i32) = .empty; | 2014 | var list: ArrayList(i32) = .empty; |
| 2032 | defer list.deinit(a); | 2015 | defer list.deinit(a); |
| 2033 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 2016 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2034 | 2017 | ||
| ... | @@ -2037,7 +2020,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -2037,7 +2020,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 2037 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); | 2020 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); |
| 2038 | } | 2021 | } |
| 2039 | { | 2022 | { |
| 2040 | var list: ArrayListUnmanaged(i32) = .empty; | 2023 | var list: ArrayList(i32) = .empty; |
| 2041 | defer list.deinit(a); | 2024 | defer list.deinit(a); |
| 2042 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 2025 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2043 | 2026 | ||
| ... | @@ -2050,7 +2033,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -2050,7 +2033,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 2050 | ); | 2033 | ); |
| 2051 | } | 2034 | } |
| 2052 | { | 2035 | { |
| 2053 | var list: ArrayListUnmanaged(i32) = .empty; | 2036 | var list: ArrayList(i32) = .empty; |
| 2054 | defer list.deinit(a); | 2037 | defer list.deinit(a); |
| 2055 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 2038 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2056 | 2039 | ||
| ... | @@ -2059,7 +2042,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -2059,7 +2042,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 2059 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); | 2042 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); |
| 2060 | } | 2043 | } |
| 2061 | { | 2044 | { |
| 2062 | var list: ArrayListUnmanaged(i32) = .empty; | 2045 | var list: ArrayList(i32) = .empty; |
| 2063 | defer list.deinit(a); | 2046 | defer list.deinit(a); |
| 2064 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 2047 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2065 | 2048 | ||
| ... | @@ -2068,7 +2051,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -2068,7 +2051,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 2068 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); | 2051 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); |
| 2069 | } | 2052 | } |
| 2070 | { | 2053 | { |
| 2071 | var list: ArrayListUnmanaged(i32) = .empty; | 2054 | var list: ArrayList(i32) = .empty; |
| 2072 | defer list.deinit(a); | 2055 | defer list.deinit(a); |
| 2073 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 2056 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 2074 | 2057 | ||
| ... | @@ -2080,15 +2063,15 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -2080,15 +2063,15 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 2080 | 2063 | ||
| 2081 | const Item = struct { | 2064 | const Item = struct { |
| 2082 | integer: i32, | 2065 | integer: i32, |
| 2083 | sub_items: ArrayList(Item), | 2066 | sub_items: Managed(Item), |
| 2084 | }; | 2067 | }; |
| 2085 | 2068 | ||
| 2086 | const ItemUnmanaged = struct { | 2069 | const ItemUnmanaged = struct { |
| 2087 | integer: i32, | 2070 | integer: i32, |
| 2088 | sub_items: ArrayListUnmanaged(ItemUnmanaged), | 2071 | sub_items: ArrayList(ItemUnmanaged), |
| 2089 | }; | 2072 | }; |
| 2090 | 2073 | ||
| 2091 | test "ArrayList(T) of struct T" { | 2074 | test "Managed(T) of struct T" { |
| 2092 | const a = std.testing.allocator; | 2075 | const a = std.testing.allocator; |
| 2093 | { | 2076 | { |
| 2094 | var root = Item{ .integer = 1, .sub_items = .init(a) }; | 2077 | var root = Item{ .integer = 1, .sub_items = .init(a) }; |
| ... | @@ -2104,11 +2087,11 @@ test "ArrayList(T) of struct T" { | ... | @@ -2104,11 +2087,11 @@ test "ArrayList(T) of struct T" { |
| 2104 | } | 2087 | } |
| 2105 | } | 2088 | } |
| 2106 | 2089 | ||
| 2107 | test "ArrayList(u8) implements writer" { | 2090 | test "Managed(u8) implements writer" { |
| 2108 | const a = testing.allocator; | 2091 | const a = testing.allocator; |
| 2109 | 2092 | ||
| 2110 | { | 2093 | { |
| 2111 | var buffer = ArrayList(u8).init(a); | 2094 | var buffer = Managed(u8).init(a); |
| 2112 | defer buffer.deinit(); | 2095 | defer buffer.deinit(); |
| 2113 | 2096 | ||
| 2114 | const x: i32 = 42; | 2097 | const x: i32 = 42; |
| ... | @@ -2118,7 +2101,7 @@ test "ArrayList(u8) implements writer" { | ... | @@ -2118,7 +2101,7 @@ test "ArrayList(u8) implements writer" { |
| 2118 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); | 2101 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); |
| 2119 | } | 2102 | } |
| 2120 | { | 2103 | { |
| 2121 | var list = ArrayListAligned(u8, .@"2").init(a); | 2104 | var list = AlignedManaged(u8, .@"2").init(a); |
| 2122 | defer list.deinit(); | 2105 | defer list.deinit(); |
| 2123 | 2106 | ||
| 2124 | const writer = list.writer(); | 2107 | const writer = list.writer(); |
| ... | @@ -2131,11 +2114,11 @@ test "ArrayList(u8) implements writer" { | ... | @@ -2131,11 +2114,11 @@ test "ArrayList(u8) implements writer" { |
| 2131 | } | 2114 | } |
| 2132 | } | 2115 | } |
| 2133 | 2116 | ||
| 2134 | test "ArrayListUnmanaged(u8) implements writer" { | 2117 | test "ArrayList(u8) implements writer" { |
| 2135 | const a = testing.allocator; | 2118 | const a = testing.allocator; |
| 2136 | 2119 | ||
| 2137 | { | 2120 | { |
| 2138 | var buffer: ArrayListUnmanaged(u8) = .empty; | 2121 | var buffer: ArrayList(u8) = .empty; |
| 2139 | defer buffer.deinit(a); | 2122 | defer buffer.deinit(a); |
| 2140 | 2123 | ||
| 2141 | const x: i32 = 42; | 2124 | const x: i32 = 42; |
| ... | @@ -2145,7 +2128,7 @@ test "ArrayListUnmanaged(u8) implements writer" { | ... | @@ -2145,7 +2128,7 @@ test "ArrayListUnmanaged(u8) implements writer" { |
| 2145 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); | 2128 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); |
| 2146 | } | 2129 | } |
| 2147 | { | 2130 | { |
| 2148 | var list: ArrayListAlignedUnmanaged(u8, .@"2") = .empty; | 2131 | var list: Aligned(u8, .@"2") = .empty; |
| 2149 | defer list.deinit(a); | 2132 | defer list.deinit(a); |
| 2150 | 2133 | ||
| 2151 | const writer = list.writer(a); | 2134 | const writer = list.writer(a); |
| ... | @@ -2163,7 +2146,7 @@ test "shrink still sets length when resizing is disabled" { | ... | @@ -2163,7 +2146,7 @@ test "shrink still sets length when resizing is disabled" { |
| 2163 | const a = failing_allocator.allocator(); | 2146 | const a = failing_allocator.allocator(); |
| 2164 | 2147 | ||
| 2165 | { | 2148 | { |
| 2166 | var list = ArrayList(i32).init(a); | 2149 | var list = Managed(i32).init(a); |
| 2167 | defer list.deinit(); | 2150 | defer list.deinit(); |
| 2168 | 2151 | ||
| 2169 | try list.append(1); | 2152 | try list.append(1); |
| ... | @@ -2174,7 +2157,7 @@ test "shrink still sets length when resizing is disabled" { | ... | @@ -2174,7 +2157,7 @@ test "shrink still sets length when resizing is disabled" { |
| 2174 | try testing.expect(list.items.len == 1); | 2157 | try testing.expect(list.items.len == 1); |
| 2175 | } | 2158 | } |
| 2176 | { | 2159 | { |
| 2177 | var list: ArrayListUnmanaged(i32) = .empty; | 2160 | var list: ArrayList(i32) = .empty; |
| 2178 | defer list.deinit(a); | 2161 | defer list.deinit(a); |
| 2179 | 2162 | ||
| 2180 | try list.append(a, 1); | 2163 | try list.append(a, 1); |
| ... | @@ -2190,7 +2173,7 @@ test "shrinkAndFree with a copy" { | ... | @@ -2190,7 +2173,7 @@ test "shrinkAndFree with a copy" { |
| 2190 | var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 }); | 2173 | var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 }); |
| 2191 | const a = failing_allocator.allocator(); | 2174 | const a = failing_allocator.allocator(); |
| 2192 | 2175 | ||
| 2193 | var list = ArrayList(i32).init(a); | 2176 | var list = Managed(i32).init(a); |
| 2194 | defer list.deinit(); | 2177 | defer list.deinit(); |
| 2195 | 2178 | ||
| 2196 | try list.appendNTimes(3, 16); | 2179 | try list.appendNTimes(3, 16); |
| ... | @@ -2201,7 +2184,7 @@ test "shrinkAndFree with a copy" { | ... | @@ -2201,7 +2184,7 @@ test "shrinkAndFree with a copy" { |
| 2201 | test "addManyAsArray" { | 2184 | test "addManyAsArray" { |
| 2202 | const a = std.testing.allocator; | 2185 | const a = std.testing.allocator; |
| 2203 | { | 2186 | { |
| 2204 | var list = ArrayList(u8).init(a); | 2187 | var list = Managed(u8).init(a); |
| 2205 | defer list.deinit(); | 2188 | defer list.deinit(); |
| 2206 | 2189 | ||
| 2207 | (try list.addManyAsArray(4)).* = "aoeu".*; | 2190 | (try list.addManyAsArray(4)).* = "aoeu".*; |
| ... | @@ -2211,7 +2194,7 @@ test "addManyAsArray" { | ... | @@ -2211,7 +2194,7 @@ test "addManyAsArray" { |
| 2211 | try testing.expectEqualSlices(u8, list.items, "aoeuasdf"); | 2194 | try testing.expectEqualSlices(u8, list.items, "aoeuasdf"); |
| 2212 | } | 2195 | } |
| 2213 | { | 2196 | { |
| 2214 | var list: ArrayListUnmanaged(u8) = .empty; | 2197 | var list: ArrayList(u8) = .empty; |
| 2215 | defer list.deinit(a); | 2198 | defer list.deinit(a); |
| 2216 | 2199 | ||
| 2217 | (try list.addManyAsArray(a, 4)).* = "aoeu".*; | 2200 | (try list.addManyAsArray(a, 4)).* = "aoeu".*; |
| ... | @@ -2227,7 +2210,7 @@ test "growing memory preserves contents" { | ... | @@ -2227,7 +2210,7 @@ test "growing memory preserves contents" { |
| 2227 | // will be triggered in the next operation. | 2210 | // will be triggered in the next operation. |
| 2228 | const a = std.testing.allocator; | 2211 | const a = std.testing.allocator; |
| 2229 | { | 2212 | { |
| 2230 | var list = ArrayList(u8).init(a); | 2213 | var list = Managed(u8).init(a); |
| 2231 | defer list.deinit(); | 2214 | defer list.deinit(); |
| 2232 | 2215 | ||
| 2233 | (try list.addManyAsArray(4)).* = "abcd".*; | 2216 | (try list.addManyAsArray(4)).* = "abcd".*; |
| ... | @@ -2241,7 +2224,7 @@ test "growing memory preserves contents" { | ... | @@ -2241,7 +2224,7 @@ test "growing memory preserves contents" { |
| 2241 | try testing.expectEqualSlices(u8, list.items, "abcdijklefgh"); | 2224 | try testing.expectEqualSlices(u8, list.items, "abcdijklefgh"); |
| 2242 | } | 2225 | } |
| 2243 | { | 2226 | { |
| 2244 | var list: ArrayListUnmanaged(u8) = .empty; | 2227 | var list: ArrayList(u8) = .empty; |
| 2245 | defer list.deinit(a); | 2228 | defer list.deinit(a); |
| 2246 | 2229 | ||
| 2247 | (try list.addManyAsArray(a, 4)).* = "abcd".*; | 2230 | (try list.addManyAsArray(a, 4)).* = "abcd".*; |
| ... | @@ -2259,22 +2242,22 @@ test "growing memory preserves contents" { | ... | @@ -2259,22 +2242,22 @@ test "growing memory preserves contents" { |
| 2259 | test "fromOwnedSlice" { | 2242 | test "fromOwnedSlice" { |
| 2260 | const a = testing.allocator; | 2243 | const a = testing.allocator; |
| 2261 | { | 2244 | { |
| 2262 | var orig_list = ArrayList(u8).init(a); | 2245 | var orig_list = Managed(u8).init(a); |
| 2263 | defer orig_list.deinit(); | 2246 | defer orig_list.deinit(); |
| 2264 | try orig_list.appendSlice("foobar"); | 2247 | try orig_list.appendSlice("foobar"); |
| 2265 | 2248 | ||
| 2266 | const slice = try orig_list.toOwnedSlice(); | 2249 | const slice = try orig_list.toOwnedSlice(); |
| 2267 | var list = ArrayList(u8).fromOwnedSlice(a, slice); | 2250 | var list = Managed(u8).fromOwnedSlice(a, slice); |
| 2268 | defer list.deinit(); | 2251 | defer list.deinit(); |
| 2269 | try testing.expectEqualStrings(list.items, "foobar"); | 2252 | try testing.expectEqualStrings(list.items, "foobar"); |
| 2270 | } | 2253 | } |
| 2271 | { | 2254 | { |
| 2272 | var list = ArrayList(u8).init(a); | 2255 | var list = Managed(u8).init(a); |
| 2273 | defer list.deinit(); | 2256 | defer list.deinit(); |
| 2274 | try list.appendSlice("foobar"); | 2257 | try list.appendSlice("foobar"); |
| 2275 | 2258 | ||
| 2276 | const slice = try list.toOwnedSlice(); | 2259 | const slice = try list.toOwnedSlice(); |
| 2277 | var unmanaged = ArrayListUnmanaged(u8).fromOwnedSlice(slice); | 2260 | var unmanaged = ArrayList(u8).fromOwnedSlice(slice); |
| 2278 | defer unmanaged.deinit(a); | 2261 | defer unmanaged.deinit(a); |
| 2279 | try testing.expectEqualStrings(unmanaged.items, "foobar"); | 2262 | try testing.expectEqualStrings(unmanaged.items, "foobar"); |
| 2280 | } | 2263 | } |
| ... | @@ -2283,22 +2266,22 @@ test "fromOwnedSlice" { | ... | @@ -2283,22 +2266,22 @@ test "fromOwnedSlice" { |
| 2283 | test "fromOwnedSliceSentinel" { | 2266 | test "fromOwnedSliceSentinel" { |
| 2284 | const a = testing.allocator; | 2267 | const a = testing.allocator; |
| 2285 | { | 2268 | { |
| 2286 | var orig_list = ArrayList(u8).init(a); | 2269 | var orig_list = Managed(u8).init(a); |
| 2287 | defer orig_list.deinit(); | 2270 | defer orig_list.deinit(); |
| 2288 | try orig_list.appendSlice("foobar"); | 2271 | try orig_list.appendSlice("foobar"); |
| 2289 | 2272 | ||
| 2290 | const sentinel_slice = try orig_list.toOwnedSliceSentinel(0); | 2273 | 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); |
| 2292 | defer list.deinit(); | 2275 | defer list.deinit(); |
| 2293 | try testing.expectEqualStrings(list.items, "foobar"); | 2276 | try testing.expectEqualStrings(list.items, "foobar"); |
| 2294 | } | 2277 | } |
| 2295 | { | 2278 | { |
| 2296 | var list = ArrayList(u8).init(a); | 2279 | var list = Managed(u8).init(a); |
| 2297 | defer list.deinit(); | 2280 | defer list.deinit(); |
| 2298 | try list.appendSlice("foobar"); | 2281 | try list.appendSlice("foobar"); |
| 2299 | 2282 | ||
| 2300 | const sentinel_slice = try list.toOwnedSliceSentinel(0); | 2283 | 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); |
| 2302 | defer unmanaged.deinit(a); | 2285 | defer unmanaged.deinit(a); |
| 2303 | try testing.expectEqualStrings(unmanaged.items, "foobar"); | 2286 | try testing.expectEqualStrings(unmanaged.items, "foobar"); |
| 2304 | } | 2287 | } |
| ... | @@ -2307,7 +2290,7 @@ test "fromOwnedSliceSentinel" { | ... | @@ -2307,7 +2290,7 @@ test "fromOwnedSliceSentinel" { |
| 2307 | test "toOwnedSliceSentinel" { | 2290 | test "toOwnedSliceSentinel" { |
| 2308 | const a = testing.allocator; | 2291 | const a = testing.allocator; |
| 2309 | { | 2292 | { |
| 2310 | var list = ArrayList(u8).init(a); | 2293 | var list = Managed(u8).init(a); |
| 2311 | defer list.deinit(); | 2294 | defer list.deinit(); |
| 2312 | 2295 | ||
| 2313 | try list.appendSlice("foobar"); | 2296 | try list.appendSlice("foobar"); |
| ... | @@ -2317,7 +2300,7 @@ test "toOwnedSliceSentinel" { | ... | @@ -2317,7 +2300,7 @@ test "toOwnedSliceSentinel" { |
| 2317 | try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0)); | 2300 | try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0)); |
| 2318 | } | 2301 | } |
| 2319 | { | 2302 | { |
| 2320 | var list: ArrayListUnmanaged(u8) = .empty; | 2303 | var list: ArrayList(u8) = .empty; |
| 2321 | defer list.deinit(a); | 2304 | defer list.deinit(a); |
| 2322 | 2305 | ||
| 2323 | try list.appendSlice(a, "foobar"); | 2306 | try list.appendSlice(a, "foobar"); |
| ... | @@ -2331,7 +2314,7 @@ test "toOwnedSliceSentinel" { | ... | @@ -2331,7 +2314,7 @@ test "toOwnedSliceSentinel" { |
| 2331 | test "accepts unaligned slices" { | 2314 | test "accepts unaligned slices" { |
| 2332 | const a = testing.allocator; | 2315 | const a = testing.allocator; |
| 2333 | { | 2316 | { |
| 2334 | var list = std.ArrayListAligned(u8, .@"8").init(a); | 2317 | var list = AlignedManaged(u8, .@"8").init(a); |
| 2335 | defer list.deinit(); | 2318 | defer list.deinit(); |
| 2336 | 2319 | ||
| 2337 | try list.appendSlice(&.{ 0, 1, 2, 3 }); | 2320 | try list.appendSlice(&.{ 0, 1, 2, 3 }); |
| ... | @@ -2341,7 +2324,7 @@ test "accepts unaligned slices" { | ... | @@ -2341,7 +2324,7 @@ test "accepts unaligned slices" { |
| 2341 | try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 }); | 2324 | try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 }); |
| 2342 | } | 2325 | } |
| 2343 | { | 2326 | { |
| 2344 | var list: std.ArrayListAlignedUnmanaged(u8, .@"8") = .empty; | 2327 | var list: Aligned(u8, .@"8") = .empty; |
| 2345 | defer list.deinit(a); | 2328 | defer list.deinit(a); |
| 2346 | 2329 | ||
| 2347 | try list.appendSlice(a, &.{ 0, 1, 2, 3 }); | 2330 | try list.appendSlice(a, &.{ 0, 1, 2, 3 }); |
| ... | @@ -2352,11 +2335,11 @@ test "accepts unaligned slices" { | ... | @@ -2352,11 +2335,11 @@ test "accepts unaligned slices" { |
| 2352 | } | 2335 | } |
| 2353 | } | 2336 | } |
| 2354 | 2337 | ||
| 2355 | test "ArrayList(u0)" { | 2338 | test "Managed(u0)" { |
| 2356 | // An ArrayList on zero-sized types should not need to allocate | 2339 | // An Managed on zero-sized types should not need to allocate |
| 2357 | const a = testing.failing_allocator; | 2340 | const a = testing.failing_allocator; |
| 2358 | 2341 | ||
| 2359 | var list = ArrayList(u0).init(a); | 2342 | var list = Managed(u0).init(a); |
| 2360 | defer list.deinit(); | 2343 | defer list.deinit(); |
| 2361 | 2344 | ||
| 2362 | try list.append(0); | 2345 | try list.append(0); |
| ... | @@ -2372,10 +2355,10 @@ test "ArrayList(u0)" { | ... | @@ -2372,10 +2355,10 @@ test "ArrayList(u0)" { |
| 2372 | try testing.expectEqual(count, 3); | 2355 | try testing.expectEqual(count, 3); |
| 2373 | } | 2356 | } |
| 2374 | 2357 | ||
| 2375 | test "ArrayList(?u32).pop()" { | 2358 | test "Managed(?u32).pop()" { |
| 2376 | const a = testing.allocator; | 2359 | const a = testing.allocator; |
| 2377 | 2360 | ||
| 2378 | var list = ArrayList(?u32).init(a); | 2361 | var list = Managed(?u32).init(a); |
| 2379 | defer list.deinit(); | 2362 | defer list.deinit(); |
| 2380 | 2363 | ||
| 2381 | try list.append(null); | 2364 | try list.append(null); |
| ... | @@ -2389,10 +2372,10 @@ test "ArrayList(?u32).pop()" { | ... | @@ -2389,10 +2372,10 @@ test "ArrayList(?u32).pop()" { |
| 2389 | try testing.expect(list.pop() == null); | 2372 | try testing.expect(list.pop() == null); |
| 2390 | } | 2373 | } |
| 2391 | 2374 | ||
| 2392 | test "ArrayList(u32).getLast()" { | 2375 | test "Managed(u32).getLast()" { |
| 2393 | const a = testing.allocator; | 2376 | const a = testing.allocator; |
| 2394 | 2377 | ||
| 2395 | var list = ArrayList(u32).init(a); | 2378 | var list = Managed(u32).init(a); |
| 2396 | defer list.deinit(); | 2379 | defer list.deinit(); |
| 2397 | 2380 | ||
| 2398 | try list.append(2); | 2381 | try list.append(2); |
| ... | @@ -2400,10 +2383,10 @@ test "ArrayList(u32).getLast()" { | ... | @@ -2400,10 +2383,10 @@ test "ArrayList(u32).getLast()" { |
| 2400 | try testing.expectEqual(const_list.getLast(), 2); | 2383 | try testing.expectEqual(const_list.getLast(), 2); |
| 2401 | } | 2384 | } |
| 2402 | 2385 | ||
| 2403 | test "ArrayList(u32).getLastOrNull()" { | 2386 | test "Managed(u32).getLastOrNull()" { |
| 2404 | const a = testing.allocator; | 2387 | const a = testing.allocator; |
| 2405 | 2388 | ||
| 2406 | var list = ArrayList(u32).init(a); | 2389 | var list = Managed(u32).init(a); |
| 2407 | defer list.deinit(); | 2390 | defer list.deinit(); |
| 2408 | 2391 | ||
| 2409 | try testing.expectEqual(list.getLastOrNull(), null); | 2392 | try testing.expectEqual(list.getLastOrNull(), null); |
| ... | @@ -2419,7 +2402,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value" | ... | @@ -2419,7 +2402,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value" |
| 2419 | const items = &.{ 42, 43 }; | 2402 | const items = &.{ 42, 43 }; |
| 2420 | 2403 | ||
| 2421 | { | 2404 | { |
| 2422 | var list: ArrayListUnmanaged(u32) = .{ | 2405 | var list: ArrayList(u32) = .{ |
| 2423 | .items = undefined, | 2406 | .items = undefined, |
| 2424 | .capacity = math.maxInt(usize) - 1, | 2407 | .capacity = math.maxInt(usize) - 1, |
| 2425 | }; | 2408 | }; |
| ... | @@ -2436,7 +2419,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value" | ... | @@ -2436,7 +2419,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value" |
| 2436 | } | 2419 | } |
| 2437 | 2420 | ||
| 2438 | { | 2421 | { |
| 2439 | var list: ArrayList(u32) = .{ | 2422 | var list: Managed(u32) = .{ |
| 2440 | .items = undefined, | 2423 | .items = undefined, |
| 2441 | .capacity = math.maxInt(usize) - 1, | 2424 | .capacity = math.maxInt(usize) - 1, |
| 2442 | .allocator = a, | 2425 | .allocator = a, |
| ... | @@ -2457,7 +2440,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value" | ... | @@ -2457,7 +2440,7 @@ test "return OutOfMemory when capacity would exceed maximum usize integer value" |
| 2457 | test "orderedRemoveMany" { | 2440 | test "orderedRemoveMany" { |
| 2458 | const gpa = testing.allocator; | 2441 | const gpa = testing.allocator; |
| 2459 | 2442 | ||
| 2460 | var list: ArrayListUnmanaged(usize) = .empty; | 2443 | var list: Aligned(usize, null) = .empty; |
| 2461 | defer list.deinit(gpa); | 2444 | defer list.deinit(gpa); |
| 2462 | 2445 | ||
| 2463 | for (0..10) |n| { | 2446 | for (0..10) |n| { |
lib/std/compress/lzma2.zig+1-1| ... | @@ -18,7 +18,7 @@ test { | ... | @@ -18,7 +18,7 @@ test { |
| 18 | const compressed = &[_]u8{ 0x01, 0x00, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x02, 0x00, 0x06, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x0A, 0x00 }; | 18 | const compressed = &[_]u8{ 0x01, 0x00, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x02, 0x00, 0x06, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x0A, 0x00 }; |
| 19 | 19 | ||
| 20 | const allocator = std.testing.allocator; | 20 | const allocator = std.testing.allocator; |
| 21 | var decomp = std.ArrayList(u8).init(allocator); | 21 | var decomp = std.array_list.Managed(u8).init(allocator); |
| 22 | defer decomp.deinit(); | 22 | defer decomp.deinit(); |
| 23 | var stream = std.io.fixedBufferStream(compressed); | 23 | var stream = std.io.fixedBufferStream(compressed); |
| 24 | try decompress(allocator, stream.reader(), decomp.writer()); | 24 | try decompress(allocator, stream.reader(), decomp.writer()); |
lib/std/crypto/argon2.zig+3-3| ... | @@ -14,7 +14,7 @@ const pwhash = crypto.pwhash; | ... | @@ -14,7 +14,7 @@ const pwhash = crypto.pwhash; |
| 14 | 14 | ||
| 15 | const Thread = std.Thread; | 15 | const Thread = std.Thread; |
| 16 | const Blake2b512 = blake2.Blake2b512; | 16 | const Blake2b512 = blake2.Blake2b512; |
| 17 | const Blocks = std.ArrayListAligned([block_length]u64, .@"16"); | 17 | const Blocks = std.array_list.AlignedManaged([block_length]u64, .@"16"); |
| 18 | const H0 = [Blake2b512.digest_length + 8]u8; | 18 | const H0 = [Blake2b512.digest_length + 8]u8; |
| 19 | 19 | ||
| 20 | const EncodingError = crypto.errors.EncodingError; | 20 | const EncodingError = crypto.errors.EncodingError; |
| ... | @@ -252,7 +252,7 @@ fn processBlocksMt( | ... | @@ -252,7 +252,7 @@ fn processBlocksMt( |
| 252 | lanes: u32, | 252 | lanes: u32, |
| 253 | segments: u32, | 253 | segments: u32, |
| 254 | ) KdfError!void { | 254 | ) 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); |
| 256 | defer threads_list.deinit(); | 256 | defer threads_list.deinit(); |
| 257 | 257 | ||
| 258 | var n: u32 = 0; | 258 | var n: u32 = 0; |
| ... | @@ -507,7 +507,7 @@ pub fn kdf( | ... | @@ -507,7 +507,7 @@ pub fn kdf( |
| 507 | var blocks = try Blocks.initCapacity(allocator, memory); | 507 | var blocks = try Blocks.initCapacity(allocator, memory); |
| 508 | defer blocks.deinit(); | 508 | defer blocks.deinit(); |
| 509 | 509 | ||
| 510 | blocks.appendNTimesAssumeCapacity([_]u64{0} ** block_length, memory); | 510 | blocks.appendNTimesAssumeCapacity(@splat(0), memory); |
| 511 | 511 | ||
| 512 | initBlocks(&blocks, &h0, memory, params.p); | 512 | initBlocks(&blocks, &h0, memory, params.p); |
| 513 | try processBlocks(allocator, &blocks, params.t, memory, params.p, mode); | 513 | 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; | ... | @@ -27,6 +27,7 @@ const maxInt = std.math.maxInt; |
| 27 | const MemoryAccessor = std.debug.MemoryAccessor; | 27 | const MemoryAccessor = std.debug.MemoryAccessor; |
| 28 | const Path = std.Build.Cache.Path; | 28 | const Path = std.Build.Cache.Path; |
| 29 | const FixedBufferReader = std.debug.FixedBufferReader; | 29 | const FixedBufferReader = std.debug.FixedBufferReader; |
| 30 | const ArrayList = std.ArrayList; | ||
| 30 | 31 | ||
| 31 | const Dwarf = @This(); | 32 | const Dwarf = @This(); |
| 32 | 33 | ||
| ... | @@ -42,11 +43,11 @@ sections: SectionArray = null_section_array, | ... | @@ -42,11 +43,11 @@ sections: SectionArray = null_section_array, |
| 42 | is_macho: bool, | 43 | is_macho: bool, |
| 43 | 44 | ||
| 44 | /// Filled later by the initializer | 45 | /// Filled later by the initializer |
| 45 | abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .empty, | 46 | abbrev_table_list: ArrayList(Abbrev.Table) = .empty, |
| 46 | /// Filled later by the initializer | 47 | /// Filled later by the initializer |
| 47 | compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .empty, | 48 | compile_unit_list: ArrayList(CompileUnit) = .empty, |
| 48 | /// Filled later by the initializer | 49 | /// Filled later by the initializer |
| 49 | func_list: std.ArrayListUnmanaged(Func) = .empty, | 50 | func_list: ArrayList(Func) = .empty, |
| 50 | 51 | ||
| 51 | /// Starts out non-`null` if the `.eh_frame_hdr` section is present. May become `null` later if we | 52 | /// Starts out non-`null` if the `.eh_frame_hdr` section is present. May become `null` later if we |
| 52 | /// find that `.eh_frame_hdr` is incomplete. | 53 | /// find that `.eh_frame_hdr` is incomplete. |
| ... | @@ -54,10 +55,10 @@ eh_frame_hdr: ?ExceptionFrameHeader = null, | ... | @@ -54,10 +55,10 @@ eh_frame_hdr: ?ExceptionFrameHeader = null, |
| 54 | /// These lookup tables are only used if `eh_frame_hdr` is null | 55 | /// These lookup tables are only used if `eh_frame_hdr` is null |
| 55 | cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty, | 56 | cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty, |
| 56 | /// Sorted by start_pc | 57 | /// Sorted by start_pc |
| 57 | fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .empty, | 58 | fde_list: ArrayList(FrameDescriptionEntry) = .empty, |
| 58 | 59 | ||
| 59 | /// Populated by `populateRanges`. | 60 | /// Populated by `populateRanges`. |
| 60 | ranges: std.ArrayListUnmanaged(Range) = .empty, | 61 | ranges: ArrayList(Range) = .empty, |
| 61 | 62 | ||
| 62 | pub const Range = struct { | 63 | pub const Range = struct { |
| 63 | start: u64, | 64 | start: u64, |
| ... | @@ -1038,7 +1039,7 @@ fn scanAllCompileUnits(di: *Dwarf, allocator: Allocator) ScanError!void { | ... | @@ -1038,7 +1039,7 @@ fn scanAllCompileUnits(di: *Dwarf, allocator: Allocator) ScanError!void { |
| 1038 | var fbr: FixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian }; | 1039 | var fbr: FixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian }; |
| 1039 | var this_unit_offset: u64 = 0; | 1040 | var this_unit_offset: u64 = 0; |
| 1040 | 1041 | ||
| 1041 | var attrs_buf = std.ArrayList(Die.Attr).init(allocator); | 1042 | var attrs_buf = std.array_list.Managed(Die.Attr).init(allocator); |
| 1042 | defer attrs_buf.deinit(); | 1043 | defer attrs_buf.deinit(); |
| 1043 | 1044 | ||
| 1044 | while (this_unit_offset < fbr.buf.len) { | 1045 | while (this_unit_offset < fbr.buf.len) { |
| ... | @@ -1343,7 +1344,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table | ... | @@ -1343,7 +1344,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table |
| 1343 | .endian = di.endian, | 1344 | .endian = di.endian, |
| 1344 | }; | 1345 | }; |
| 1345 | 1346 | ||
| 1346 | var abbrevs = std.ArrayList(Abbrev).init(allocator); | 1347 | var abbrevs = std.array_list.Managed(Abbrev).init(allocator); |
| 1347 | defer { | 1348 | defer { |
| 1348 | for (abbrevs.items) |*abbrev| { | 1349 | for (abbrevs.items) |*abbrev| { |
| 1349 | abbrev.deinit(allocator); | 1350 | abbrev.deinit(allocator); |
| ... | @@ -1351,7 +1352,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table | ... | @@ -1351,7 +1352,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table |
| 1351 | abbrevs.deinit(); | 1352 | abbrevs.deinit(); |
| 1352 | } | 1353 | } |
| 1353 | 1354 | ||
| 1354 | var attrs = std.ArrayList(Abbrev.Attr).init(allocator); | 1355 | var attrs = std.array_list.Managed(Abbrev.Attr).init(allocator); |
| 1355 | defer attrs.deinit(); | 1356 | defer attrs.deinit(); |
| 1356 | 1357 | ||
| 1357 | while (true) { | 1358 | while (true) { |
| ... | @@ -1468,9 +1469,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) ! | ... | @@ -1468,9 +1469,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) ! |
| 1468 | 1469 | ||
| 1469 | const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1); | 1470 | const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1); |
| 1470 | 1471 | ||
| 1471 | var directories: std.ArrayListUnmanaged(FileEntry) = .empty; | 1472 | var directories: ArrayList(FileEntry) = .empty; |
| 1472 | defer directories.deinit(gpa); | 1473 | defer directories.deinit(gpa); |
| 1473 | var file_entries: std.ArrayListUnmanaged(FileEntry) = .empty; | 1474 | var file_entries: ArrayList(FileEntry) = .empty; |
| 1474 | defer file_entries.deinit(gpa); | 1475 | defer file_entries.deinit(gpa); |
| 1475 | 1476 | ||
| 1476 | if (version < 5) { | 1477 | if (version < 5) { |
| ... | @@ -2244,7 +2245,7 @@ pub const ElfModule = struct { | ... | @@ -2244,7 +2245,7 @@ pub const ElfModule = struct { |
| 2244 | if (chdr.ch_type != .ZLIB) continue; | 2245 | if (chdr.ch_type != .ZLIB) continue; |
| 2245 | 2246 | ||
| 2246 | var decompress: std.compress.flate.Decompress = .init(&section_reader, .zlib, &.{}); | 2247 | 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; |
| 2248 | defer decompressed_section.deinit(gpa); | 2249 | defer decompressed_section.deinit(gpa); |
| 2249 | decompress.reader.appendRemainingUnlimited(gpa, null, &decompressed_section, std.compress.flate.history_len) catch { | 2250 | decompress.reader.appendRemainingUnlimited(gpa, null, &decompressed_section, std.compress.flate.history_len) catch { |
| 2250 | invalidDebugInfoDetected(); | 2251 | invalidDebugInfoDetected(); |
lib/std/debug/Dwarf/expression.zig+4-4| ... | @@ -1064,7 +1064,7 @@ test "DWARF expressions" { | ... | @@ -1064,7 +1064,7 @@ test "DWARF expressions" { |
| 1064 | 1064 | ||
| 1065 | const b = Builder(options); | 1065 | const b = Builder(options); |
| 1066 | 1066 | ||
| 1067 | var program = std.ArrayList(u8).init(allocator); | 1067 | var program = std.array_list.Managed(u8).init(allocator); |
| 1068 | defer program.deinit(); | 1068 | defer program.deinit(); |
| 1069 | 1069 | ||
| 1070 | const writer = program.writer(); | 1070 | const writer = program.writer(); |
| ... | @@ -1120,7 +1120,7 @@ test "DWARF expressions" { | ... | @@ -1120,7 +1120,7 @@ test "DWARF expressions" { |
| 1120 | var mock_compile_unit: std.debug.Dwarf.CompileUnit = undefined; | 1120 | var mock_compile_unit: std.debug.Dwarf.CompileUnit = undefined; |
| 1121 | mock_compile_unit.addr_base = 1; | 1121 | mock_compile_unit.addr_base = 1; |
| 1122 | 1122 | ||
| 1123 | var mock_debug_addr = std.ArrayList(u8).init(allocator); | 1123 | var mock_debug_addr = std.array_list.Managed(u8).init(allocator); |
| 1124 | defer mock_debug_addr.deinit(); | 1124 | defer mock_debug_addr.deinit(); |
| 1125 | 1125 | ||
| 1126 | try mock_debug_addr.writer().writeInt(u16, 0, native_endian); | 1126 | try mock_debug_addr.writer().writeInt(u16, 0, native_endian); |
| ... | @@ -1590,7 +1590,7 @@ test "DWARF expressions" { | ... | @@ -1590,7 +1590,7 @@ test "DWARF expressions" { |
| 1590 | 1590 | ||
| 1591 | // Sub-expression | 1591 | // Sub-expression |
| 1592 | { | 1592 | { |
| 1593 | var sub_program = std.ArrayList(u8).init(allocator); | 1593 | var sub_program = std.array_list.Managed(u8).init(allocator); |
| 1594 | defer sub_program.deinit(); | 1594 | defer sub_program.deinit(); |
| 1595 | const sub_writer = sub_program.writer(); | 1595 | const sub_writer = sub_program.writer(); |
| 1596 | try b.writeLiteral(sub_writer, 3); | 1596 | try b.writeLiteral(sub_writer, 3); |
| ... | @@ -1617,7 +1617,7 @@ test "DWARF expressions" { | ... | @@ -1617,7 +1617,7 @@ test "DWARF expressions" { |
| 1617 | if (abi.regBytes(&thread_context, 0, reg_context)) |reg_bytes| { | 1617 | if (abi.regBytes(&thread_context, 0, reg_context)) |reg_bytes| { |
| 1618 | mem.writeInt(usize, reg_bytes[0..@sizeOf(usize)], 0xee, native_endian); | 1618 | mem.writeInt(usize, reg_bytes[0..@sizeOf(usize)], 0xee, native_endian); |
| 1619 | 1619 | ||
| 1620 | var sub_program = std.ArrayList(u8).init(allocator); | 1620 | var sub_program = std.array_list.Managed(u8).init(allocator); |
| 1621 | defer sub_program.deinit(); | 1621 | defer sub_program.deinit(); |
| 1622 | const sub_writer = sub_program.writer(); | 1622 | const sub_writer = sub_program.writer(); |
| 1623 | try b.writeReg(sub_writer, 0); | 1623 | try b.writeReg(sub_writer, 0); |
lib/std/debug/Pdb.zig+3-3| ... | @@ -76,7 +76,7 @@ pub fn parseDbiStream(self: *Pdb) !void { | ... | @@ -76,7 +76,7 @@ pub fn parseDbiStream(self: *Pdb) !void { |
| 76 | const mod_info_size = header.mod_info_size; | 76 | const mod_info_size = header.mod_info_size; |
| 77 | const section_contrib_size = header.section_contribution_size; | 77 | const section_contrib_size = header.section_contribution_size; |
| 78 | 78 | ||
| 79 | var modules = std.ArrayList(Module).init(self.allocator); | 79 | var modules = std.array_list.Managed(Module).init(self.allocator); |
| 80 | errdefer modules.deinit(); | 80 | errdefer modules.deinit(); |
| 81 | 81 | ||
| 82 | // Module Info Substream | 82 | // Module Info Substream |
| ... | @@ -117,7 +117,7 @@ pub fn parseDbiStream(self: *Pdb) !void { | ... | @@ -117,7 +117,7 @@ pub fn parseDbiStream(self: *Pdb) !void { |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | // Section Contribution Substream | 119 | // 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); |
| 121 | errdefer sect_contribs.deinit(); | 121 | errdefer sect_contribs.deinit(); |
| 122 | 122 | ||
| 123 | var sect_cont_offset: usize = 0; | 123 | var sect_cont_offset: usize = 0; |
| ... | @@ -569,7 +569,7 @@ const MsfStream = struct { | ... | @@ -569,7 +569,7 @@ const MsfStream = struct { |
| 569 | 569 | ||
| 570 | fn readSparseBitVector(stream: anytype, allocator: Allocator) ![]u32 { | 570 | fn readSparseBitVector(stream: anytype, allocator: Allocator) ![]u32 { |
| 571 | const num_words = try stream.readInt(u32, .little); | 571 | 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); |
| 573 | errdefer list.deinit(); | 573 | errdefer list.deinit(); |
| 574 | var word_i: u32 = 0; | 574 | var word_i: u32 = 0; |
| 575 | while (word_i != num_words) : (word_i += 1) { | 575 | while (word_i != num_words) : (word_i += 1) { |
lib/std/fs/File.zig+1-1| ... | @@ -826,7 +826,7 @@ pub fn readToEndAllocOptions( | ... | @@ -826,7 +826,7 @@ pub fn readToEndAllocOptions( |
| 826 | // size. If the reported size is zero, as it happens on Linux for files | 826 | // size. If the reported size is zero, as it happens on Linux for files |
| 827 | // in /proc, a small buffer is allocated instead. | 827 | // in /proc, a small buffer is allocated instead. |
| 828 | const initial_cap = @min((if (size > 0) size else 1024), max_bytes) + @intFromBool(optional_sentinel != null); | 828 | 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); |
| 830 | defer array_list.deinit(); | 830 | defer array_list.deinit(); |
| 831 | 831 | ||
| 832 | self.deprecatedReader().readAllArrayListAligned(alignment, &array_list, max_bytes) catch |err| switch (err) { | 832 | 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 { | ... | @@ -577,7 +577,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 { |
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | // Allocate result and fill in the disk designator. | 579 | // 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); |
| 581 | defer result.deinit(); | 581 | defer result.deinit(); |
| 582 | 582 | ||
| 583 | const disk_designator_len: usize = l: { | 583 | const disk_designator_len: usize = l: { |
| ... | @@ -698,7 +698,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 { | ... | @@ -698,7 +698,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 { |
| 698 | pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.Error![]u8 { | 698 | pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.Error![]u8 { |
| 699 | assert(paths.len > 0); | 699 | assert(paths.len > 0); |
| 700 | 700 | ||
| 701 | var result = std.ArrayList(u8).init(allocator); | 701 | var result = std.array_list.Managed(u8).init(allocator); |
| 702 | defer result.deinit(); | 702 | defer result.deinit(); |
| 703 | 703 | ||
| 704 | var negative_count: usize = 0; | 704 | var negative_count: usize = 0; |
lib/std/fs/test.zig+5-5| ... | @@ -464,7 +464,7 @@ test "Dir.Iterator" { | ... | @@ -464,7 +464,7 @@ test "Dir.Iterator" { |
| 464 | defer arena.deinit(); | 464 | defer arena.deinit(); |
| 465 | const allocator = arena.allocator(); | 465 | const allocator = arena.allocator(); |
| 466 | 466 | ||
| 467 | var entries = std.ArrayList(Dir.Entry).init(allocator); | 467 | var entries = std.array_list.Managed(Dir.Entry).init(allocator); |
| 468 | 468 | ||
| 469 | // Create iterator. | 469 | // Create iterator. |
| 470 | var iter = tmp_dir.dir.iterate(); | 470 | var iter = tmp_dir.dir.iterate(); |
| ... | @@ -497,7 +497,7 @@ test "Dir.Iterator many entries" { | ... | @@ -497,7 +497,7 @@ test "Dir.Iterator many entries" { |
| 497 | defer arena.deinit(); | 497 | defer arena.deinit(); |
| 498 | const allocator = arena.allocator(); | 498 | const allocator = arena.allocator(); |
| 499 | 499 | ||
| 500 | var entries = std.ArrayList(Dir.Entry).init(allocator); | 500 | var entries = std.array_list.Managed(Dir.Entry).init(allocator); |
| 501 | 501 | ||
| 502 | // Create iterator. | 502 | // Create iterator. |
| 503 | var iter = tmp_dir.dir.iterate(); | 503 | var iter = tmp_dir.dir.iterate(); |
| ... | @@ -531,7 +531,7 @@ test "Dir.Iterator twice" { | ... | @@ -531,7 +531,7 @@ test "Dir.Iterator twice" { |
| 531 | 531 | ||
| 532 | var i: u8 = 0; | 532 | var i: u8 = 0; |
| 533 | while (i < 2) : (i += 1) { | 533 | 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); |
| 535 | 535 | ||
| 536 | // Create iterator. | 536 | // Create iterator. |
| 537 | var iter = tmp_dir.dir.iterate(); | 537 | var iter = tmp_dir.dir.iterate(); |
| ... | @@ -567,7 +567,7 @@ test "Dir.Iterator reset" { | ... | @@ -567,7 +567,7 @@ test "Dir.Iterator reset" { |
| 567 | 567 | ||
| 568 | var i: u8 = 0; | 568 | var i: u8 = 0; |
| 569 | while (i < 2) : (i += 1) { | 569 | 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); |
| 571 | 571 | ||
| 572 | while (try iter.next()) |entry| { | 572 | while (try iter.next()) |entry| { |
| 573 | // We cannot just store `entry` as on Windows, we're re-using the name buffer | 573 | // 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 { | ... | @@ -617,7 +617,7 @@ fn entryEql(lhs: Dir.Entry, rhs: Dir.Entry) bool { |
| 617 | return mem.eql(u8, lhs.name, rhs.name) and lhs.kind == rhs.kind; | 617 | return mem.eql(u8, lhs.name, rhs.name) and lhs.kind == rhs.kind; |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | fn contains(entries: *const std.ArrayList(Dir.Entry), el: Dir.Entry) bool { | 620 | fn contains(entries: *const std.array_list.Managed(Dir.Entry), el: Dir.Entry) bool { |
| 621 | for (entries.items) |entry| { | 621 | for (entries.items) |entry| { |
| 622 | if (entryEql(entry, el)) return true; | 622 | if (entryEql(entry, el)) return true; |
| 623 | } | 623 | } |
lib/std/hash_map.zig+2-2| ... | @@ -1800,7 +1800,7 @@ test "put and remove loop in random order" { | ... | @@ -1800,7 +1800,7 @@ test "put and remove loop in random order" { |
| 1800 | var map = AutoHashMap(u32, u32).init(std.testing.allocator); | 1800 | var map = AutoHashMap(u32, u32).init(std.testing.allocator); |
| 1801 | defer map.deinit(); | 1801 | defer map.deinit(); |
| 1802 | 1802 | ||
| 1803 | var keys = std.ArrayList(u32).init(std.testing.allocator); | 1803 | var keys = std.array_list.Managed(u32).init(std.testing.allocator); |
| 1804 | defer keys.deinit(); | 1804 | defer keys.deinit(); |
| 1805 | 1805 | ||
| 1806 | const size = 32; | 1806 | const size = 32; |
| ... | @@ -1834,7 +1834,7 @@ test "remove one million elements in random order" { | ... | @@ -1834,7 +1834,7 @@ test "remove one million elements in random order" { |
| 1834 | var map = Map.init(std.heap.page_allocator); | 1834 | var map = Map.init(std.heap.page_allocator); |
| 1835 | defer map.deinit(); | 1835 | defer map.deinit(); |
| 1836 | 1836 | ||
| 1837 | var keys = std.ArrayList(u32).init(std.heap.page_allocator); | 1837 | var keys = std.array_list.Managed(u32).init(std.heap.page_allocator); |
| 1838 | defer keys.deinit(); | 1838 | defer keys.deinit(); |
| 1839 | 1839 | ||
| 1840 | var i: u32 = 0; | 1840 | var i: u32 = 0; |
lib/std/heap.zig+1-1| ... | @@ -673,7 +673,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void { | ... | @@ -673,7 +673,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void { |
| 673 | var slice = try allocator.alignedAlloc(u8, .@"16", alloc_size); | 673 | var slice = try allocator.alignedAlloc(u8, .@"16", alloc_size); |
| 674 | defer allocator.free(slice); | 674 | defer allocator.free(slice); |
| 675 | 675 | ||
| 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); |
| 677 | // On Windows, VirtualAlloc returns addresses aligned to a 64K boundary, | 677 | // On Windows, VirtualAlloc returns addresses aligned to a 64K boundary, |
| 678 | // which is 16 pages, hence the 32. This test may require to increase | 678 | // which is 16 pages, hence the 32. This test may require to increase |
| 679 | // the size of the allocations feeding the `allocator` parameter if they | 679 | // 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" { | ... | @@ -1061,7 +1061,7 @@ test "small allocations - free in same order" { |
| 1061 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); | 1061 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); |
| 1062 | const allocator = gpa.allocator(); | 1062 | const allocator = gpa.allocator(); |
| 1063 | 1063 | ||
| 1064 | var list = std.ArrayList(*u64).init(std.testing.allocator); | 1064 | var list = std.array_list.Managed(*u64).init(std.testing.allocator); |
| 1065 | defer list.deinit(); | 1065 | defer list.deinit(); |
| 1066 | 1066 | ||
| 1067 | var i: usize = 0; | 1067 | var i: usize = 0; |
| ... | @@ -1080,7 +1080,7 @@ test "small allocations - free in reverse order" { | ... | @@ -1080,7 +1080,7 @@ test "small allocations - free in reverse order" { |
| 1080 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); | 1080 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); |
| 1081 | const allocator = gpa.allocator(); | 1081 | const allocator = gpa.allocator(); |
| 1082 | 1082 | ||
| 1083 | var list = std.ArrayList(*u64).init(std.testing.allocator); | 1083 | var list = std.array_list.Managed(*u64).init(std.testing.allocator); |
| 1084 | defer list.deinit(); | 1084 | defer list.deinit(); |
| 1085 | 1085 | ||
| 1086 | var i: usize = 0; | 1086 | var i: usize = 0; |
| ... | @@ -1241,7 +1241,7 @@ test "shrink large object to large object with larger alignment" { | ... | @@ -1241,7 +1241,7 @@ test "shrink large object to large object with larger alignment" { |
| 1241 | // This loop allocates until we find a page that is not aligned to the big | 1241 | // This loop allocates until we find a page that is not aligned to the big |
| 1242 | // alignment. Then we shrink the allocation after the loop, but increase the | 1242 | // alignment. Then we shrink the allocation after the loop, but increase the |
| 1243 | // alignment to the higher one, that we know will force it to realloc. | 1243 | // 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); |
| 1245 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { | 1245 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { |
| 1246 | try stuff_to_free.append(slice); | 1246 | try stuff_to_free.append(slice); |
| 1247 | slice = try allocator.alignedAlloc(u8, .@"16", alloc_size); | 1247 | slice = try allocator.alignedAlloc(u8, .@"16", alloc_size); |
| ... | @@ -1313,7 +1313,7 @@ test "realloc large object to larger alignment" { | ... | @@ -1313,7 +1313,7 @@ test "realloc large object to larger alignment" { |
| 1313 | 1313 | ||
| 1314 | const big_alignment: usize = default_page_size * 2; | 1314 | const big_alignment: usize = default_page_size * 2; |
| 1315 | // This loop allocates until we find a page that is not aligned to the big alignment. | 1315 | // 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); |
| 1317 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { | 1317 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { |
| 1318 | try stuff_to_free.append(slice); | 1318 | try stuff_to_free.append(slice); |
| 1319 | slice = try allocator.alignedAlloc(u8, .@"16", default_page_size * 2 + 50); | 1319 | 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" { | ... | @@ -298,7 +298,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" { |
| 298 | const response = try stream_reader.interface().allocRemaining(gpa, .unlimited); | 298 | const response = try stream_reader.interface().allocRemaining(gpa, .unlimited); |
| 299 | defer gpa.free(response); | 299 | defer gpa.free(response); |
| 300 | 300 | ||
| 301 | var expected_response = std.ArrayList(u8).init(gpa); | 301 | var expected_response = std.array_list.Managed(u8).init(gpa); |
| 302 | defer expected_response.deinit(); | 302 | defer expected_response.deinit(); |
| 303 | 303 | ||
| 304 | try expected_response.appendSlice("HTTP/1.1 200 OK\r\nconnection: close\r\n\r\n"); | 304 | 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" { | ... | @@ -369,7 +369,7 @@ test "receiving arbitrary http headers from the client" { |
| 369 | const response = try stream_reader.interface().allocRemaining(gpa, .unlimited); | 369 | const response = try stream_reader.interface().allocRemaining(gpa, .unlimited); |
| 370 | defer gpa.free(response); | 370 | defer gpa.free(response); |
| 371 | 371 | ||
| 372 | var expected_response = std.ArrayList(u8).init(gpa); | 372 | var expected_response = std.array_list.Managed(u8).init(gpa); |
| 373 | defer expected_response.deinit(); | 373 | defer expected_response.deinit(); |
| 374 | 374 | ||
| 375 | try expected_response.appendSlice("HTTP/1.1 200 OK\r\n"); | 375 | 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(); | ... | @@ -46,7 +46,6 @@ const Scanner = @This(); |
| 46 | const std = @import("std"); | 46 | const std = @import("std"); |
| 47 | 47 | ||
| 48 | const Allocator = std.mem.Allocator; | 48 | const Allocator = std.mem.Allocator; |
| 49 | const ArrayList = std.ArrayList; | ||
| 50 | const assert = std.debug.assert; | 49 | const assert = std.debug.assert; |
| 51 | const BitStack = std.BitStack; | 50 | const BitStack = std.BitStack; |
| 52 | 51 | ||
| ... | @@ -136,7 +135,7 @@ pub fn nextAllocMax(self: *@This(), allocator: Allocator, when: AllocWhen, max_v | ... | @@ -136,7 +135,7 @@ pub fn nextAllocMax(self: *@This(), allocator: Allocator, when: AllocWhen, max_v |
| 136 | }; | 135 | }; |
| 137 | switch (token_type) { | 136 | switch (token_type) { |
| 138 | .number, .string => { | 137 | .number, .string => { |
| 139 | var value_list = ArrayList(u8).init(allocator); | 138 | var value_list = std.array_list.Managed(u8).init(allocator); |
| 140 | errdefer { | 139 | errdefer { |
| 141 | value_list.deinit(); | 140 | value_list.deinit(); |
| 142 | } | 141 | } |
| ... | @@ -173,7 +172,7 @@ pub fn nextAllocMax(self: *@This(), allocator: Allocator, when: AllocWhen, max_v | ... | @@ -173,7 +172,7 @@ pub fn nextAllocMax(self: *@This(), allocator: Allocator, when: AllocWhen, max_v |
| 173 | } | 172 | } |
| 174 | 173 | ||
| 175 | /// Equivalent to `allocNextIntoArrayListMax(value_list, when, default_max_value_len);` | 174 | /// Equivalent to `allocNextIntoArrayListMax(value_list, when, default_max_value_len);` |
| 176 | pub fn allocNextIntoArrayList(self: *@This(), value_list: *ArrayList(u8), when: AllocWhen) AllocIntoArrayListError!?[]const u8 { | 175 | pub fn allocNextIntoArrayList(self: *@This(), value_list: *std.array_list.Managed(u8), when: AllocWhen) AllocIntoArrayListError!?[]const u8 { |
| 177 | return self.allocNextIntoArrayListMax(value_list, when, default_max_value_len); | 176 | return self.allocNextIntoArrayListMax(value_list, when, default_max_value_len); |
| 178 | } | 177 | } |
| 179 | /// The next token type must be either `.number` or `.string`. See `peekNextTokenType()`. | 178 | /// 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: | ... | @@ -186,7 +185,7 @@ pub fn allocNextIntoArrayList(self: *@This(), value_list: *ArrayList(u8), when: |
| 186 | /// can be resumed by passing the same array list in again. | 185 | /// can be resumed by passing the same array list in again. |
| 187 | /// This method does not indicate whether the token content being returned is for a `.number` or `.string` token type; | 186 | /// This method does not indicate whether the token content being returned is for a `.number` or `.string` token type; |
| 188 | /// the caller of this method is expected to know which type of token is being processed. | 187 | /// the caller of this method is expected to know which type of token is being processed. |
| 189 | pub fn allocNextIntoArrayListMax(self: *@This(), value_list: *ArrayList(u8), when: AllocWhen, max_value_len: usize) AllocIntoArrayListError!?[]const u8 { | 188 | pub fn allocNextIntoArrayListMax(self: *@This(), value_list: *std.array_list.Managed(u8), when: AllocWhen, max_value_len: usize) AllocIntoArrayListError!?[]const u8 { |
| 190 | while (true) { | 189 | while (true) { |
| 191 | const token = try self.next(); | 190 | const token = try self.next(); |
| 192 | switch (token) { | 191 | switch (token) { |
| ... | @@ -1608,7 +1607,7 @@ pub const Reader = struct { | ... | @@ -1608,7 +1607,7 @@ pub const Reader = struct { |
| 1608 | const token_type = try self.peekNextTokenType(); | 1607 | const token_type = try self.peekNextTokenType(); |
| 1609 | switch (token_type) { | 1608 | switch (token_type) { |
| 1610 | .number, .string => { | 1609 | .number, .string => { |
| 1611 | var value_list = ArrayList(u8).init(allocator); | 1610 | var value_list = std.array_list.Managed(u8).init(allocator); |
| 1612 | errdefer { | 1611 | errdefer { |
| 1613 | value_list.deinit(); | 1612 | value_list.deinit(); |
| 1614 | } | 1613 | } |
| ... | @@ -1639,11 +1638,11 @@ pub const Reader = struct { | ... | @@ -1639,11 +1638,11 @@ pub const Reader = struct { |
| 1639 | } | 1638 | } |
| 1640 | 1639 | ||
| 1641 | /// Equivalent to `allocNextIntoArrayListMax(value_list, when, default_max_value_len);` | 1640 | /// 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 { |
| 1643 | return self.allocNextIntoArrayListMax(value_list, when, default_max_value_len); | 1642 | return self.allocNextIntoArrayListMax(value_list, when, default_max_value_len); |
| 1644 | } | 1643 | } |
| 1645 | /// Calls `std.json.Scanner.allocNextIntoArrayListMax` and handles `error.BufferUnderrun`. | 1644 | /// 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 { |
| 1647 | while (true) { | 1646 | while (true) { |
| 1648 | return self.scanner.allocNextIntoArrayListMax(value_list, when, max_value_len) catch |err| switch (err) { | 1647 | return self.scanner.allocNextIntoArrayListMax(value_list, when, max_value_len) catch |err| switch (err) { |
| 1649 | error.BufferUnderrun => { | 1648 | error.BufferUnderrun => { |
| ... | @@ -1746,7 +1745,7 @@ pub const Reader = struct { | ... | @@ -1746,7 +1745,7 @@ pub const Reader = struct { |
| 1746 | const OBJECT_MODE = 0; | 1745 | const OBJECT_MODE = 0; |
| 1747 | const ARRAY_MODE = 1; | 1746 | const ARRAY_MODE = 1; |
| 1748 | 1747 | ||
| 1749 | fn appendSlice(list: *std.ArrayList(u8), buf: []const u8, max_value_len: usize) !void { | 1748 | fn appendSlice(list: *std.array_list.Managed(u8), buf: []const u8, max_value_len: usize) !void { |
| 1750 | const new_len = std.math.add(usize, list.items.len, buf.len) catch return error.ValueTooLong; | 1749 | const new_len = std.math.add(usize, list.items.len, buf.len) catch return error.ValueTooLong; |
| 1751 | if (new_len > max_value_len) return error.ValueTooLong; | 1750 | if (new_len > max_value_len) return error.ValueTooLong; |
| 1752 | try list.appendSlice(buf); | 1751 | try list.appendSlice(buf); |
lib/std/json/dynamic.zig+1-2| ... | @@ -1,7 +1,6 @@ | ... | @@ -1,7 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const debug = std.debug; | 2 | const debug = std.debug; |
| 3 | const ArenaAllocator = std.heap.ArenaAllocator; | 3 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 4 | const ArrayList = std.ArrayList; | ||
| 5 | const StringArrayHashMap = std.StringArrayHashMap; | 4 | const StringArrayHashMap = std.StringArrayHashMap; |
| 6 | const Allocator = std.mem.Allocator; | 5 | const Allocator = std.mem.Allocator; |
| 7 | const json = std.json; | 6 | const json = std.json; |
| ... | @@ -12,7 +11,7 @@ const ParseError = @import("./static.zig").ParseError; | ... | @@ -12,7 +11,7 @@ const ParseError = @import("./static.zig").ParseError; |
| 12 | const isNumberFormattedLikeAnInteger = @import("Scanner.zig").isNumberFormattedLikeAnInteger; | 11 | const isNumberFormattedLikeAnInteger = @import("Scanner.zig").isNumberFormattedLikeAnInteger; |
| 13 | 12 | ||
| 14 | pub const ObjectMap = StringArrayHashMap(Value); | 13 | pub const ObjectMap = StringArrayHashMap(Value); |
| 15 | pub const Array = ArrayList(Value); | 14 | pub const Array = std.array_list.Managed(Value); |
| 16 | 15 | ||
| 17 | /// Represents any JSON value, potentially containing other JSON values. | 16 | /// Represents any JSON value, potentially containing other JSON values. |
| 18 | /// A .float value may be an approximation of the original value. | 17 | /// 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"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const assert = std.debug.assert; | 2 | const assert = std.debug.assert; |
| 3 | const Allocator = std.mem.Allocator; | 3 | const Allocator = std.mem.Allocator; |
| 4 | const ArenaAllocator = std.heap.ArenaAllocator; | 4 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 5 | const ArrayList = std.ArrayList; | 5 | const ArrayList = std.array_list.Managed; |
| 6 | 6 | ||
| 7 | const Scanner = @import("Scanner.zig"); | 7 | const Scanner = @import("Scanner.zig"); |
| 8 | const Token = Scanner.Token; | 8 | const Token = Scanner.Token; |
lib/std/math/big/int.zig+4-4| ... | @@ -1412,7 +1412,7 @@ pub const Mutable = struct { | ... | @@ -1412,7 +1412,7 @@ pub const Mutable = struct { |
| 1412 | /// | 1412 | /// |
| 1413 | /// `limbs_buffer` is used for temporary storage during the operation. When this function returns, | 1413 | /// `limbs_buffer` is used for temporary storage during the operation. When this function returns, |
| 1414 | /// it will have the same length as it had when the function was called. | 1414 | /// 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 { |
| 1416 | const prev_len = limbs_buffer.items.len; | 1416 | const prev_len = limbs_buffer.items.len; |
| 1417 | defer limbs_buffer.shrinkRetainingCapacity(prev_len); | 1417 | defer limbs_buffer.shrinkRetainingCapacity(prev_len); |
| 1418 | const x_copy = if (rma.limbs.ptr == x.limbs.ptr) blk: { | 1418 | const x_copy = if (rma.limbs.ptr == x.limbs.ptr) blk: { |
| ... | @@ -1538,13 +1538,13 @@ pub const Mutable = struct { | ... | @@ -1538,13 +1538,13 @@ pub const Mutable = struct { |
| 1538 | /// Asserts that `rma` has enough limbs to store the result. Upper bound is given by `calcGcdNoAliasLimbLen`. | 1538 | /// Asserts that `rma` has enough limbs to store the result. Upper bound is given by `calcGcdNoAliasLimbLen`. |
| 1539 | /// | 1539 | /// |
| 1540 | /// `limbs_buffer` is used for temporary storage during the operation. | 1540 | /// `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 { |
| 1542 | assert(rma.limbs.ptr != x.limbs.ptr); // illegal aliasing | 1542 | assert(rma.limbs.ptr != x.limbs.ptr); // illegal aliasing |
| 1543 | assert(rma.limbs.ptr != y.limbs.ptr); // illegal aliasing | 1543 | assert(rma.limbs.ptr != y.limbs.ptr); // illegal aliasing |
| 1544 | return gcdLehmer(rma, x, y, limbs_buffer); | 1544 | return gcdLehmer(rma, x, y, limbs_buffer); |
| 1545 | } | 1545 | } |
| 1546 | 1546 | ||
| 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 { |
| 1548 | var x = try xa.toManaged(limbs_buffer.allocator); | 1548 | var x = try xa.toManaged(limbs_buffer.allocator); |
| 1549 | defer x.deinit(); | 1549 | defer x.deinit(); |
| 1550 | x.abs(); | 1550 | x.abs(); |
| ... | @@ -3267,7 +3267,7 @@ pub const Managed = struct { | ... | @@ -3267,7 +3267,7 @@ pub const Managed = struct { |
| 3267 | pub fn gcd(rma: *Managed, x: *const Managed, y: *const Managed) !void { | 3267 | pub fn gcd(rma: *Managed, x: *const Managed, y: *const Managed) !void { |
| 3268 | try rma.ensureCapacity(@min(x.len(), y.len())); | 3268 | try rma.ensureCapacity(@min(x.len(), y.len())); |
| 3269 | var m = rma.toMutable(); | 3269 | 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); |
| 3271 | defer limbs_buffer.deinit(); | 3271 | defer limbs_buffer.deinit(); |
| 3272 | try m.gcd(x.toConst(), y.toConst(), &limbs_buffer); | 3272 | try m.gcd(x.toConst(), y.toConst(), &limbs_buffer); |
| 3273 | rma.setMetadata(m.positive, m.len); | 3273 | 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 { | ... | @@ -964,7 +964,7 @@ fn fuzzTestMinMax(rng: std.Random, queue_size: usize) !void { |
| 964 | } | 964 | } |
| 965 | 965 | ||
| 966 | fn generateRandomSlice(allocator: std.mem.Allocator, rng: std.Random, size: usize) ![]u32 { | 966 | fn 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); |
| 968 | try array.ensureTotalCapacity(size); | 968 | try array.ensureTotalCapacity(size); |
| 969 | 969 | ||
| 970 | var i: usize = 0; | 970 | var i: usize = 0; |
lib/std/process.zig+2-2| ... | @@ -1241,10 +1241,10 @@ pub fn argsAlloc(allocator: Allocator) ![][:0]u8 { | ... | @@ -1241,10 +1241,10 @@ pub fn argsAlloc(allocator: Allocator) ![][:0]u8 { |
| 1241 | var it = try argsWithAllocator(allocator); | 1241 | var it = try argsWithAllocator(allocator); |
| 1242 | defer it.deinit(); | 1242 | defer it.deinit(); |
| 1243 | 1243 | ||
| 1244 | var contents = std.ArrayList(u8).init(allocator); | 1244 | var contents = std.array_list.Managed(u8).init(allocator); |
| 1245 | defer contents.deinit(); | 1245 | defer contents.deinit(); |
| 1246 | 1246 | ||
| 1247 | var slice_list = std.ArrayList(usize).init(allocator); | 1247 | var slice_list = std.array_list.Managed(usize).init(allocator); |
| 1248 | defer slice_list.deinit(); | 1248 | defer slice_list.deinit(); |
| 1249 | 1249 | ||
| 1250 | while (it.next()) |arg| { | 1250 | while (it.next()) |arg| { |
lib/std/process/Child.zig+3-3| ... | @@ -14,7 +14,7 @@ const assert = std.debug.assert; | ... | @@ -14,7 +14,7 @@ const assert = std.debug.assert; |
| 14 | const native_os = builtin.os.tag; | 14 | const native_os = builtin.os.tag; |
| 15 | const Allocator = std.mem.Allocator; | 15 | const Allocator = std.mem.Allocator; |
| 16 | const ChildProcess = @This(); | 16 | const ChildProcess = @This(); |
| 17 | const ArrayList = std.ArrayListUnmanaged; | 17 | const ArrayList = std.ArrayList; |
| 18 | 18 | ||
| 19 | pub const Id = switch (native_os) { | 19 | pub const Id = switch (native_os) { |
| 20 | .windows => windows.HANDLE, | 20 | .windows => windows.HANDLE, |
| ... | @@ -1545,7 +1545,7 @@ fn argvToCommandLineWindows( | ... | @@ -1545,7 +1545,7 @@ fn argvToCommandLineWindows( |
| 1545 | allocator: mem.Allocator, | 1545 | allocator: mem.Allocator, |
| 1546 | argv: []const []const u8, | 1546 | argv: []const []const u8, |
| 1547 | ) ArgvToCommandLineError![:0]u16 { | 1547 | ) ArgvToCommandLineError![:0]u16 { |
| 1548 | var buf = std.ArrayList(u8).init(allocator); | 1548 | var buf = std.array_list.Managed(u8).init(allocator); |
| 1549 | defer buf.deinit(); | 1549 | defer buf.deinit(); |
| 1550 | 1550 | ||
| 1551 | if (argv.len != 0) { | 1551 | if (argv.len != 0) { |
| ... | @@ -1725,7 +1725,7 @@ fn argvToScriptCommandLineWindows( | ... | @@ -1725,7 +1725,7 @@ fn argvToScriptCommandLineWindows( |
| 1725 | /// Arguments, not including the script name itself. Expected to be encoded as WTF-8. | 1725 | /// Arguments, not including the script name itself. Expected to be encoded as WTF-8. |
| 1726 | script_args: []const []const u8, | 1726 | script_args: []const []const u8, |
| 1727 | ) ArgvToScriptCommandLineError![:0]u16 { | 1727 | ) 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); |
| 1729 | defer buf.deinit(); | 1729 | defer buf.deinit(); |
| 1730 | 1730 | ||
| 1731 | // `/d` disables execution of AutoRun commands. | 1731 | // `/d` disables execution of AutoRun commands. |
lib/std/std.zig+18-4| ... | @@ -1,9 +1,5 @@ | ... | @@ -1,9 +1,5 @@ |
| 1 | pub const ArrayHashMap = array_hash_map.ArrayHashMap; | 1 | pub const ArrayHashMap = array_hash_map.ArrayHashMap; |
| 2 | pub const ArrayHashMapUnmanaged = array_hash_map.ArrayHashMapUnmanaged; | 2 | pub const ArrayHashMapUnmanaged = array_hash_map.ArrayHashMapUnmanaged; |
| 3 | pub const ArrayList = @import("array_list.zig").ArrayList; | ||
| 4 | pub const ArrayListAligned = @import("array_list.zig").ArrayListAligned; | ||
| 5 | pub const ArrayListAlignedUnmanaged = @import("array_list.zig").ArrayListAlignedUnmanaged; | ||
| 6 | pub const ArrayListUnmanaged = @import("array_list.zig").ArrayListUnmanaged; | ||
| 7 | pub const AutoArrayHashMap = array_hash_map.AutoArrayHashMap; | 3 | pub const AutoArrayHashMap = array_hash_map.AutoArrayHashMap; |
| 8 | pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged; | 4 | pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged; |
| 9 | pub const AutoHashMap = hash_map.AutoHashMap; | 5 | pub const AutoHashMap = hash_map.AutoHashMap; |
| ... | @@ -43,6 +39,24 @@ pub const Treap = @import("treap.zig").Treap; | ... | @@ -43,6 +39,24 @@ pub const Treap = @import("treap.zig").Treap; |
| 43 | pub const Tz = tz.Tz; | 39 | pub const Tz = tz.Tz; |
| 44 | pub const Uri = @import("Uri.zig"); | 40 | pub const Uri = @import("Uri.zig"); |
| 45 | 41 | ||
| 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`. | ||
| 48 | pub fn ArrayList(comptime T: type) type { | ||
| 49 | return array_list.Aligned(T, null); | ||
| 50 | } | ||
| 51 | pub const array_list = @import("array_list.zig"); | ||
| 52 | |||
| 53 | /// Deprecated; use `array_list.Aligned`. | ||
| 54 | pub const ArrayListAligned = array_list.Aligned; | ||
| 55 | /// Deprecated; use `array_list.Aligned`. | ||
| 56 | pub const ArrayListAlignedUnmanaged = array_list.Aligned; | ||
| 57 | /// Deprecated; use `ArrayList`. | ||
| 58 | pub const ArrayListUnmanaged = ArrayList; | ||
| 59 | |||
| 46 | pub const array_hash_map = @import("array_hash_map.zig"); | 60 | pub const array_hash_map = @import("array_hash_map.zig"); |
| 47 | pub const atomic = @import("atomic.zig"); | 61 | pub const atomic = @import("atomic.zig"); |
| 48 | pub const base64 = @import("base64.zig"); | 62 | pub const base64 = @import("base64.zig"); |
lib/std/treap.zig+1-1| ... | @@ -641,7 +641,7 @@ test "node.{prev(),next()} with random data" { | ... | @@ -641,7 +641,7 @@ test "node.{prev(),next()} with random data" { |
| 641 | 641 | ||
| 642 | var treap = TestTreap{}; | 642 | var treap = TestTreap{}; |
| 643 | // A slow, stupid but correct reference. Ordered. | 643 | // 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); |
| 645 | defer golden.deinit(); | 645 | defer golden.deinit(); |
| 646 | 646 | ||
| 647 | // Insert. | 647 | // Insert. |
lib/std/unicode.zig+21-21| ... | @@ -916,7 +916,7 @@ test fmtUtf8 { | ... | @@ -916,7 +916,7 @@ test fmtUtf8 { |
| 916 | } | 916 | } |
| 917 | 917 | ||
| 918 | fn utf16LeToUtf8ArrayListImpl( | 918 | fn utf16LeToUtf8ArrayListImpl( |
| 919 | result: *std.ArrayList(u8), | 919 | result: *std.array_list.Managed(u8), |
| 920 | utf16le: []const u16, | 920 | utf16le: []const u16, |
| 921 | comptime surrogates: Surrogates, | 921 | comptime surrogates: Surrogates, |
| 922 | ) (switch (surrogates) { | 922 | ) (switch (surrogates) { |
| ... | @@ -967,7 +967,7 @@ fn utf16LeToUtf8ArrayListImpl( | ... | @@ -967,7 +967,7 @@ fn utf16LeToUtf8ArrayListImpl( |
| 967 | 967 | ||
| 968 | pub const Utf16LeToUtf8AllocError = mem.Allocator.Error || Utf16LeToUtf8Error; | 968 | pub const Utf16LeToUtf8AllocError = mem.Allocator.Error || Utf16LeToUtf8Error; |
| 969 | 969 | ||
| 970 | pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) Utf16LeToUtf8AllocError!void { | 970 | pub fn utf16LeToUtf8ArrayList(result: *std.array_list.Managed(u8), utf16le: []const u16) Utf16LeToUtf8AllocError!void { |
| 971 | try result.ensureUnusedCapacity(utf16le.len); | 971 | try result.ensureUnusedCapacity(utf16le.len); |
| 972 | return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half); | 972 | return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half); |
| 973 | } | 973 | } |
| ... | @@ -975,7 +975,7 @@ pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) | ... | @@ -975,7 +975,7 @@ pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) |
| 975 | /// Caller must free returned memory. | 975 | /// Caller must free returned memory. |
| 976 | pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 { | 976 | pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 { |
| 977 | // optimistically guess that it will all be ascii. | 977 | // 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); |
| 979 | errdefer result.deinit(); | 979 | errdefer result.deinit(); |
| 980 | 980 | ||
| 981 | try utf16LeToUtf8ArrayListImpl(&result, utf16le, .cannot_encode_surrogate_half); | 981 | try utf16LeToUtf8ArrayListImpl(&result, utf16le, .cannot_encode_surrogate_half); |
| ... | @@ -985,7 +985,7 @@ pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16L | ... | @@ -985,7 +985,7 @@ pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16L |
| 985 | /// Caller must free returned memory. | 985 | /// Caller must free returned memory. |
| 986 | pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 { | 986 | pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 { |
| 987 | // optimistically guess that it will all be ascii (and allocate space for the null terminator) | 987 | // 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); |
| 989 | errdefer result.deinit(); | 989 | errdefer result.deinit(); |
| 990 | 990 | ||
| 991 | try utf16LeToUtf8ArrayListImpl(&result, utf16le, .cannot_encode_surrogate_half); | 991 | try utf16LeToUtf8ArrayListImpl(&result, utf16le, .cannot_encode_surrogate_half); |
| ... | @@ -1117,7 +1117,7 @@ test utf16LeToUtf8 { | ... | @@ -1117,7 +1117,7 @@ test utf16LeToUtf8 { |
| 1117 | } | 1117 | } |
| 1118 | } | 1118 | } |
| 1119 | 1119 | ||
| 1120 | fn utf8ToUtf16LeArrayListImpl(result: *std.ArrayList(u16), utf8: []const u8, comptime surrogates: Surrogates) !void { | 1120 | fn utf8ToUtf16LeArrayListImpl(result: *std.array_list.Managed(u16), utf8: []const u8, comptime surrogates: Surrogates) !void { |
| 1121 | assert(result.unusedCapacitySlice().len >= utf8.len); | 1121 | assert(result.unusedCapacitySlice().len >= utf8.len); |
| 1122 | 1122 | ||
| 1123 | var remaining = utf8; | 1123 | var remaining = utf8; |
| ... | @@ -1155,14 +1155,14 @@ fn utf8ToUtf16LeArrayListImpl(result: *std.ArrayList(u16), utf8: []const u8, com | ... | @@ -1155,14 +1155,14 @@ fn utf8ToUtf16LeArrayListImpl(result: *std.ArrayList(u16), utf8: []const u8, com |
| 1155 | } | 1155 | } |
| 1156 | } | 1156 | } |
| 1157 | 1157 | ||
| 1158 | pub fn utf8ToUtf16LeArrayList(result: *std.ArrayList(u16), utf8: []const u8) error{ InvalidUtf8, OutOfMemory }!void { | 1158 | pub fn utf8ToUtf16LeArrayList(result: *std.array_list.Managed(u16), utf8: []const u8) error{ InvalidUtf8, OutOfMemory }!void { |
| 1159 | try result.ensureUnusedCapacity(utf8.len); | 1159 | try result.ensureUnusedCapacity(utf8.len); |
| 1160 | return utf8ToUtf16LeArrayListImpl(result, utf8, .cannot_encode_surrogate_half); | 1160 | return utf8ToUtf16LeArrayListImpl(result, utf8, .cannot_encode_surrogate_half); |
| 1161 | } | 1161 | } |
| 1162 | 1162 | ||
| 1163 | pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![]u16 { | 1163 | pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![]u16 { |
| 1164 | // optimistically guess that it will not require surrogate pairs | 1164 | // 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); |
| 1166 | errdefer result.deinit(); | 1166 | errdefer result.deinit(); |
| 1167 | 1167 | ||
| 1168 | try utf8ToUtf16LeArrayListImpl(&result, utf8, .cannot_encode_surrogate_half); | 1168 | try utf8ToUtf16LeArrayListImpl(&result, utf8, .cannot_encode_surrogate_half); |
| ... | @@ -1171,7 +1171,7 @@ pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ Inv | ... | @@ -1171,7 +1171,7 @@ pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ Inv |
| 1171 | 1171 | ||
| 1172 | pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 { | 1172 | pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 { |
| 1173 | // optimistically guess that it will not require surrogate pairs | 1173 | // 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); |
| 1175 | errdefer result.deinit(); | 1175 | errdefer result.deinit(); |
| 1176 | 1176 | ||
| 1177 | try utf8ToUtf16LeArrayListImpl(&result, utf8, .cannot_encode_surrogate_half); | 1177 | try utf8ToUtf16LeArrayListImpl(&result, utf8, .cannot_encode_surrogate_half); |
| ... | @@ -1258,19 +1258,19 @@ test utf8ToUtf16Le { | ... | @@ -1258,19 +1258,19 @@ test utf8ToUtf16Le { |
| 1258 | 1258 | ||
| 1259 | test utf8ToUtf16LeArrayList { | 1259 | test utf8ToUtf16LeArrayList { |
| 1260 | { | 1260 | { |
| 1261 | var list = std.ArrayList(u16).init(testing.allocator); | 1261 | var list = std.array_list.Managed(u16).init(testing.allocator); |
| 1262 | defer list.deinit(); | 1262 | defer list.deinit(); |
| 1263 | try utf8ToUtf16LeArrayList(&list, "𐐷"); | 1263 | try utf8ToUtf16LeArrayList(&list, "𐐷"); |
| 1264 | try testing.expectEqualSlices(u8, "\x01\xd8\x37\xdc", mem.sliceAsBytes(list.items)); | 1264 | try testing.expectEqualSlices(u8, "\x01\xd8\x37\xdc", mem.sliceAsBytes(list.items)); |
| 1265 | } | 1265 | } |
| 1266 | { | 1266 | { |
| 1267 | var list = std.ArrayList(u16).init(testing.allocator); | 1267 | var list = std.array_list.Managed(u16).init(testing.allocator); |
| 1268 | defer list.deinit(); | 1268 | defer list.deinit(); |
| 1269 | try utf8ToUtf16LeArrayList(&list, "\u{10FFFF}"); | 1269 | try utf8ToUtf16LeArrayList(&list, "\u{10FFFF}"); |
| 1270 | try testing.expectEqualSlices(u8, "\xff\xdb\xff\xdf", mem.sliceAsBytes(list.items)); | 1270 | try testing.expectEqualSlices(u8, "\xff\xdb\xff\xdf", mem.sliceAsBytes(list.items)); |
| 1271 | } | 1271 | } |
| 1272 | { | 1272 | { |
| 1273 | var list = std.ArrayList(u16).init(testing.allocator); | 1273 | var list = std.array_list.Managed(u16).init(testing.allocator); |
| 1274 | defer list.deinit(); | 1274 | defer list.deinit(); |
| 1275 | const result = utf8ToUtf16LeArrayList(&list, "\xf4\x90\x80\x80"); | 1275 | const result = utf8ToUtf16LeArrayList(&list, "\xf4\x90\x80\x80"); |
| 1276 | try testing.expectError(error.InvalidUtf8, result); | 1276 | try testing.expectError(error.InvalidUtf8, result); |
| ... | @@ -1331,7 +1331,7 @@ test utf8ToUtf16LeAllocZ { | ... | @@ -1331,7 +1331,7 @@ test utf8ToUtf16LeAllocZ { |
| 1331 | test "ArrayList functions on a re-used list" { | 1331 | test "ArrayList functions on a re-used list" { |
| 1332 | // utf8ToUtf16LeArrayList | 1332 | // utf8ToUtf16LeArrayList |
| 1333 | { | 1333 | { |
| 1334 | var list = std.ArrayList(u16).init(testing.allocator); | 1334 | var list = std.array_list.Managed(u16).init(testing.allocator); |
| 1335 | defer list.deinit(); | 1335 | defer list.deinit(); |
| 1336 | 1336 | ||
| 1337 | const init_slice = utf8ToUtf16LeStringLiteral("abcdefg"); | 1337 | const init_slice = utf8ToUtf16LeStringLiteral("abcdefg"); |
| ... | @@ -1345,7 +1345,7 @@ test "ArrayList functions on a re-used list" { | ... | @@ -1345,7 +1345,7 @@ test "ArrayList functions on a re-used list" { |
| 1345 | 1345 | ||
| 1346 | // utf16LeToUtf8ArrayList | 1346 | // utf16LeToUtf8ArrayList |
| 1347 | { | 1347 | { |
| 1348 | var list = std.ArrayList(u8).init(testing.allocator); | 1348 | var list = std.array_list.Managed(u8).init(testing.allocator); |
| 1349 | defer list.deinit(); | 1349 | defer list.deinit(); |
| 1350 | 1350 | ||
| 1351 | const init_slice = "abcdefg"; | 1351 | const init_slice = "abcdefg"; |
| ... | @@ -1359,7 +1359,7 @@ test "ArrayList functions on a re-used list" { | ... | @@ -1359,7 +1359,7 @@ test "ArrayList functions on a re-used list" { |
| 1359 | 1359 | ||
| 1360 | // wtf8ToWtf16LeArrayList | 1360 | // wtf8ToWtf16LeArrayList |
| 1361 | { | 1361 | { |
| 1362 | var list = std.ArrayList(u16).init(testing.allocator); | 1362 | var list = std.array_list.Managed(u16).init(testing.allocator); |
| 1363 | defer list.deinit(); | 1363 | defer list.deinit(); |
| 1364 | 1364 | ||
| 1365 | const init_slice = utf8ToUtf16LeStringLiteral("abcdefg"); | 1365 | const init_slice = utf8ToUtf16LeStringLiteral("abcdefg"); |
| ... | @@ -1373,7 +1373,7 @@ test "ArrayList functions on a re-used list" { | ... | @@ -1373,7 +1373,7 @@ test "ArrayList functions on a re-used list" { |
| 1373 | 1373 | ||
| 1374 | // wtf16LeToWtf8ArrayList | 1374 | // wtf16LeToWtf8ArrayList |
| 1375 | { | 1375 | { |
| 1376 | var list = std.ArrayList(u8).init(testing.allocator); | 1376 | var list = std.array_list.Managed(u8).init(testing.allocator); |
| 1377 | defer list.deinit(); | 1377 | defer list.deinit(); |
| 1378 | 1378 | ||
| 1379 | const init_slice = "abcdefg"; | 1379 | const init_slice = "abcdefg"; |
| ... | @@ -1750,7 +1750,7 @@ pub const Wtf8Iterator = struct { | ... | @@ -1750,7 +1750,7 @@ pub const Wtf8Iterator = struct { |
| 1750 | } | 1750 | } |
| 1751 | }; | 1751 | }; |
| 1752 | 1752 | ||
| 1753 | pub fn wtf16LeToWtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) mem.Allocator.Error!void { | 1753 | pub fn wtf16LeToWtf8ArrayList(result: *std.array_list.Managed(u8), utf16le: []const u16) mem.Allocator.Error!void { |
| 1754 | try result.ensureUnusedCapacity(utf16le.len); | 1754 | try result.ensureUnusedCapacity(utf16le.len); |
| 1755 | return utf16LeToUtf8ArrayListImpl(result, utf16le, .can_encode_surrogate_half); | 1755 | return utf16LeToUtf8ArrayListImpl(result, utf16le, .can_encode_surrogate_half); |
| 1756 | } | 1756 | } |
| ... | @@ -1758,7 +1758,7 @@ pub fn wtf16LeToWtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) | ... | @@ -1758,7 +1758,7 @@ pub fn wtf16LeToWtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16) |
| 1758 | /// Caller must free returned memory. | 1758 | /// Caller must free returned memory. |
| 1759 | pub fn wtf16LeToWtf8Alloc(allocator: mem.Allocator, wtf16le: []const u16) mem.Allocator.Error![]u8 { | 1759 | pub fn wtf16LeToWtf8Alloc(allocator: mem.Allocator, wtf16le: []const u16) mem.Allocator.Error![]u8 { |
| 1760 | // optimistically guess that it will all be ascii. | 1760 | // 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); |
| 1762 | errdefer result.deinit(); | 1762 | errdefer result.deinit(); |
| 1763 | 1763 | ||
| 1764 | try utf16LeToUtf8ArrayListImpl(&result, wtf16le, .can_encode_surrogate_half); | 1764 | try utf16LeToUtf8ArrayListImpl(&result, wtf16le, .can_encode_surrogate_half); |
| ... | @@ -1768,7 +1768,7 @@ pub fn wtf16LeToWtf8Alloc(allocator: mem.Allocator, wtf16le: []const u16) mem.Al | ... | @@ -1768,7 +1768,7 @@ pub fn wtf16LeToWtf8Alloc(allocator: mem.Allocator, wtf16le: []const u16) mem.Al |
| 1768 | /// Caller must free returned memory. | 1768 | /// Caller must free returned memory. |
| 1769 | pub fn wtf16LeToWtf8AllocZ(allocator: mem.Allocator, wtf16le: []const u16) mem.Allocator.Error![:0]u8 { | 1769 | pub fn wtf16LeToWtf8AllocZ(allocator: mem.Allocator, wtf16le: []const u16) mem.Allocator.Error![:0]u8 { |
| 1770 | // optimistically guess that it will all be ascii (and allocate space for the null terminator) | 1770 | // 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); |
| 1772 | errdefer result.deinit(); | 1772 | errdefer result.deinit(); |
| 1773 | 1773 | ||
| 1774 | try utf16LeToUtf8ArrayListImpl(&result, wtf16le, .can_encode_surrogate_half); | 1774 | try utf16LeToUtf8ArrayListImpl(&result, wtf16le, .can_encode_surrogate_half); |
| ... | @@ -1779,14 +1779,14 @@ pub fn wtf16LeToWtf8(wtf8: []u8, wtf16le: []const u16) usize { | ... | @@ -1779,14 +1779,14 @@ pub fn wtf16LeToWtf8(wtf8: []u8, wtf16le: []const u16) usize { |
| 1779 | return utf16LeToUtf8Impl(wtf8, wtf16le, .can_encode_surrogate_half) catch |err| switch (err) {}; | 1779 | return utf16LeToUtf8Impl(wtf8, wtf16le, .can_encode_surrogate_half) catch |err| switch (err) {}; |
| 1780 | } | 1780 | } |
| 1781 | 1781 | ||
| 1782 | pub fn wtf8ToWtf16LeArrayList(result: *std.ArrayList(u16), wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }!void { | 1782 | pub fn wtf8ToWtf16LeArrayList(result: *std.array_list.Managed(u16), wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }!void { |
| 1783 | try result.ensureUnusedCapacity(wtf8.len); | 1783 | try result.ensureUnusedCapacity(wtf8.len); |
| 1784 | return utf8ToUtf16LeArrayListImpl(result, wtf8, .can_encode_surrogate_half); | 1784 | return utf8ToUtf16LeArrayListImpl(result, wtf8, .can_encode_surrogate_half); |
| 1785 | } | 1785 | } |
| 1786 | 1786 | ||
| 1787 | pub fn wtf8ToWtf16LeAlloc(allocator: mem.Allocator, wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }![]u16 { | 1787 | pub fn wtf8ToWtf16LeAlloc(allocator: mem.Allocator, wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }![]u16 { |
| 1788 | // optimistically guess that it will not require surrogate pairs | 1788 | // 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); |
| 1790 | errdefer result.deinit(); | 1790 | errdefer result.deinit(); |
| 1791 | 1791 | ||
| 1792 | try utf8ToUtf16LeArrayListImpl(&result, wtf8, .can_encode_surrogate_half); | 1792 | try utf8ToUtf16LeArrayListImpl(&result, wtf8, .can_encode_surrogate_half); |
| ... | @@ -1795,7 +1795,7 @@ pub fn wtf8ToWtf16LeAlloc(allocator: mem.Allocator, wtf8: []const u8) error{ Inv | ... | @@ -1795,7 +1795,7 @@ pub fn wtf8ToWtf16LeAlloc(allocator: mem.Allocator, wtf8: []const u8) error{ Inv |
| 1795 | 1795 | ||
| 1796 | pub fn wtf8ToWtf16LeAllocZ(allocator: mem.Allocator, wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }![:0]u16 { | 1796 | pub fn wtf8ToWtf16LeAllocZ(allocator: mem.Allocator, wtf8: []const u8) error{ InvalidWtf8, OutOfMemory }![:0]u16 { |
| 1797 | // optimistically guess that it will not require surrogate pairs | 1797 | // 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); |
| 1799 | errdefer result.deinit(); | 1799 | errdefer result.deinit(); |
| 1800 | 1800 | ||
| 1801 | try utf8ToUtf16LeArrayListImpl(&result, wtf8, .can_encode_surrogate_half); | 1801 | 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 }; | ... | @@ -349,7 +349,7 @@ pub const LtoMode = enum { none, full, thin }; |
| 349 | /// Renders a `std.Target.Cpu` value into a textual representation that can be parsed | 349 | /// Renders a `std.Target.Cpu` value into a textual representation that can be parsed |
| 350 | /// via the `-mcpu` flag passed to the Zig compiler. | 350 | /// via the `-mcpu` flag passed to the Zig compiler. |
| 351 | /// Appends the result to `buffer`. | 351 | /// Appends the result to `buffer`. |
| 352 | pub fn serializeCpu(buffer: *std.ArrayList(u8), cpu: std.Target.Cpu) Allocator.Error!void { | 352 | pub fn serializeCpu(buffer: *std.array_list.Managed(u8), cpu: std.Target.Cpu) Allocator.Error!void { |
| 353 | const all_features = cpu.arch.allFeaturesList(); | 353 | const all_features = cpu.arch.allFeaturesList(); |
| 354 | var populated_cpu_features = cpu.model.features; | 354 | var populated_cpu_features = cpu.model.features; |
| 355 | populated_cpu_features.populateDependencies(all_features); | 355 | populated_cpu_features.populateDependencies(all_features); |
| ... | @@ -377,7 +377,7 @@ pub fn serializeCpu(buffer: *std.ArrayList(u8), cpu: std.Target.Cpu) Allocator.E | ... | @@ -377,7 +377,7 @@ pub fn serializeCpu(buffer: *std.ArrayList(u8), cpu: std.Target.Cpu) Allocator.E |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | pub fn serializeCpuAlloc(ally: Allocator, cpu: std.Target.Cpu) Allocator.Error![]u8 { | 379 | pub 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); |
| 381 | try serializeCpu(&buffer, cpu); | 381 | try serializeCpu(&buffer, cpu); |
| 382 | return buffer.toOwnedSlice(); | 382 | return buffer.toOwnedSlice(); |
| 383 | } | 383 | } |
| ... | @@ -633,7 +633,7 @@ pub fn parseTargetQueryOrReportFatalError( | ... | @@ -633,7 +633,7 @@ pub fn parseTargetQueryOrReportFatalError( |
| 633 | return std.Target.Query.parse(opts_with_diags) catch |err| switch (err) { | 633 | return std.Target.Query.parse(opts_with_diags) catch |err| switch (err) { |
| 634 | error.UnknownCpuModel => { | 634 | error.UnknownCpuModel => { |
| 635 | help: { | 635 | help: { |
| 636 | var help_text = std.ArrayList(u8).init(allocator); | 636 | var help_text = std.array_list.Managed(u8).init(allocator); |
| 637 | defer help_text.deinit(); | 637 | defer help_text.deinit(); |
| 638 | for (diags.arch.?.allCpuModels()) |cpu| { | 638 | for (diags.arch.?.allCpuModels()) |cpu| { |
| 639 | help_text.print(" {s}\n", .{cpu.name}) catch break :help; | 639 | help_text.print(" {s}\n", .{cpu.name}) catch break :help; |
| ... | @@ -646,7 +646,7 @@ pub fn parseTargetQueryOrReportFatalError( | ... | @@ -646,7 +646,7 @@ pub fn parseTargetQueryOrReportFatalError( |
| 646 | }, | 646 | }, |
| 647 | error.UnknownCpuFeature => { | 647 | error.UnknownCpuFeature => { |
| 648 | help: { | 648 | help: { |
| 649 | var help_text = std.ArrayList(u8).init(allocator); | 649 | var help_text = std.array_list.Managed(u8).init(allocator); |
| 650 | defer help_text.deinit(); | 650 | defer help_text.deinit(); |
| 651 | for (diags.arch.?.allFeaturesList()) |feature| { | 651 | for (diags.arch.?.allFeaturesList()) |feature| { |
| 652 | help_text.print(" {s}: {s}\n", .{ feature.name, feature.description }) catch break :help; | 652 | help_text.print(" {s}: {s}\n", .{ feature.name, feature.description }) catch break :help; |
| ... | @@ -659,7 +659,7 @@ pub fn parseTargetQueryOrReportFatalError( | ... | @@ -659,7 +659,7 @@ pub fn parseTargetQueryOrReportFatalError( |
| 659 | }, | 659 | }, |
| 660 | error.UnknownObjectFormat => { | 660 | error.UnknownObjectFormat => { |
| 661 | help: { | 661 | help: { |
| 662 | var help_text = std.ArrayList(u8).init(allocator); | 662 | var help_text = std.array_list.Managed(u8).init(allocator); |
| 663 | defer help_text.deinit(); | 663 | defer help_text.deinit(); |
| 664 | inline for (@typeInfo(std.Target.ObjectFormat).@"enum".fields) |field| { | 664 | inline for (@typeInfo(std.Target.ObjectFormat).@"enum".fields) |field| { |
| 665 | help_text.print(" {s}\n", .{field.name}) catch break :help; | 665 | help_text.print(" {s}\n", .{field.name}) catch break :help; |
| ... | @@ -670,7 +670,7 @@ pub fn parseTargetQueryOrReportFatalError( | ... | @@ -670,7 +670,7 @@ pub fn parseTargetQueryOrReportFatalError( |
| 670 | }, | 670 | }, |
| 671 | error.UnknownArchitecture => { | 671 | error.UnknownArchitecture => { |
| 672 | help: { | 672 | help: { |
| 673 | var help_text = std.ArrayList(u8).init(allocator); | 673 | var help_text = std.array_list.Managed(u8).init(allocator); |
| 674 | defer help_text.deinit(); | 674 | defer help_text.deinit(); |
| 675 | inline for (@typeInfo(std.Target.Cpu.Arch).@"enum".fields) |field| { | 675 | inline for (@typeInfo(std.Target.Cpu.Arch).@"enum".fields) |field| { |
| 676 | help_text.print(" {s}\n", .{field.name}) catch break :help; | 676 | 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 { | ... | @@ -3456,8 +3456,8 @@ const AutoIndentingStream = struct { |
| 3456 | 3456 | ||
| 3457 | indent_count: usize = 0, | 3457 | indent_count: usize = 0, |
| 3458 | indent_delta: usize, | 3458 | indent_delta: usize, |
| 3459 | indent_stack: std.ArrayList(StackElem), | 3459 | indent_stack: std.array_list.Managed(StackElem), |
| 3460 | space_stack: std.ArrayList(SpaceElem), | 3460 | space_stack: std.array_list.Managed(SpaceElem), |
| 3461 | space_mode: ?usize = null, | 3461 | space_mode: ?usize = null, |
| 3462 | disable_indent_committing: usize = 0, | 3462 | disable_indent_committing: usize = 0, |
| 3463 | current_line_empty: bool = true, | 3463 | current_line_empty: bool = true, |
lib/std/zig/AstGen.zig+1-1| ... | @@ -1784,7 +1784,7 @@ fn structInitExpr( | ... | @@ -1784,7 +1784,7 @@ fn structInitExpr( |
| 1784 | while (it.next()) |entry| { | 1784 | while (it.next()) |entry| { |
| 1785 | const record = entry.value_ptr.*; | 1785 | const record = entry.value_ptr.*; |
| 1786 | if (record.items.len > 1) { | 1786 | 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); |
| 1788 | 1788 | ||
| 1789 | for (record.items[1..]) |duplicate| { | 1789 | for (record.items[1..]) |duplicate| { |
| 1790 | try error_notes.append(try astgen.errNoteTok(duplicate, "duplicate name here", .{})); | 1790 | 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( | ... | @@ -89,8 +89,8 @@ pub fn detect( |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | fn detectFromInstallation(arena: Allocator, target: *const std.Target, lci: *const LibCInstallation) !LibCDirs { | 91 | fn detectFromInstallation(arena: Allocator, target: *const std.Target, lci: *const LibCInstallation) !LibCDirs { |
| 92 | var list = try std.ArrayList([]const u8).initCapacity(arena, 5); | 92 | var list = try std.array_list.Managed([]const u8).initCapacity(arena, 5); |
| 93 | var framework_list = std.ArrayList([]const u8).init(arena); | 93 | var framework_list = std.array_list.Managed([]const u8).init(arena); |
| 94 | 94 | ||
| 95 | list.appendAssumeCapacity(lci.include_dir.?); | 95 | list.appendAssumeCapacity(lci.include_dir.?); |
| 96 | 96 |
lib/std/zig/LibCInstallation.zig+7-7| ... | @@ -250,7 +250,7 @@ fn findNativeIncludeDirPosix(self: *LibCInstallation, args: FindNativeOptions) F | ... | @@ -250,7 +250,7 @@ fn findNativeIncludeDirPosix(self: *LibCInstallation, args: FindNativeOptions) F |
| 250 | 250 | ||
| 251 | const dev_null = if (is_windows) "nul" else "/dev/null"; | 251 | const dev_null = if (is_windows) "nul" else "/dev/null"; |
| 252 | 252 | ||
| 253 | var argv = std.ArrayList([]const u8).init(allocator); | 253 | var argv = std.array_list.Managed([]const u8).init(allocator); |
| 254 | defer argv.deinit(); | 254 | defer argv.deinit(); |
| 255 | 255 | ||
| 256 | try appendCcExe(&argv, skip_cc_env_var); | 256 | try appendCcExe(&argv, skip_cc_env_var); |
| ... | @@ -294,7 +294,7 @@ fn findNativeIncludeDirPosix(self: *LibCInstallation, args: FindNativeOptions) F | ... | @@ -294,7 +294,7 @@ fn findNativeIncludeDirPosix(self: *LibCInstallation, args: FindNativeOptions) F |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | var it = std.mem.tokenizeAny(u8, run_res.stderr, "\n\r"); | 296 | 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); |
| 298 | defer search_paths.deinit(); | 298 | defer search_paths.deinit(); |
| 299 | while (it.next()) |line| { | 299 | while (it.next()) |line| { |
| 300 | if (line.len != 0 and line[0] == ' ') { | 300 | if (line.len != 0 and line[0] == ' ') { |
| ... | @@ -365,7 +365,7 @@ fn findNativeIncludeDirWindows( | ... | @@ -365,7 +365,7 @@ fn findNativeIncludeDirWindows( |
| 365 | var install_buf: [2]std.zig.WindowsSdk.Installation = undefined; | 365 | var install_buf: [2]std.zig.WindowsSdk.Installation = undefined; |
| 366 | const installs = fillInstallations(&install_buf, sdk); | 366 | const installs = fillInstallations(&install_buf, sdk); |
| 367 | 367 | ||
| 368 | var result_buf = std.ArrayList(u8).init(allocator); | 368 | var result_buf = std.array_list.Managed(u8).init(allocator); |
| 369 | defer result_buf.deinit(); | 369 | defer result_buf.deinit(); |
| 370 | 370 | ||
| 371 | for (installs) |install| { | 371 | for (installs) |install| { |
| ... | @@ -404,7 +404,7 @@ fn findNativeCrtDirWindows( | ... | @@ -404,7 +404,7 @@ fn findNativeCrtDirWindows( |
| 404 | var install_buf: [2]std.zig.WindowsSdk.Installation = undefined; | 404 | var install_buf: [2]std.zig.WindowsSdk.Installation = undefined; |
| 405 | const installs = fillInstallations(&install_buf, sdk); | 405 | const installs = fillInstallations(&install_buf, sdk); |
| 406 | 406 | ||
| 407 | var result_buf = std.ArrayList(u8).init(allocator); | 407 | var result_buf = std.array_list.Managed(u8).init(allocator); |
| 408 | defer result_buf.deinit(); | 408 | defer result_buf.deinit(); |
| 409 | 409 | ||
| 410 | const arch_sub_dir = switch (args.target.cpu.arch) { | 410 | const arch_sub_dir = switch (args.target.cpu.arch) { |
| ... | @@ -471,7 +471,7 @@ fn findNativeKernel32LibDir( | ... | @@ -471,7 +471,7 @@ fn findNativeKernel32LibDir( |
| 471 | var install_buf: [2]std.zig.WindowsSdk.Installation = undefined; | 471 | var install_buf: [2]std.zig.WindowsSdk.Installation = undefined; |
| 472 | const installs = fillInstallations(&install_buf, sdk); | 472 | const installs = fillInstallations(&install_buf, sdk); |
| 473 | 473 | ||
| 474 | var result_buf = std.ArrayList(u8).init(allocator); | 474 | var result_buf = std.array_list.Managed(u8).init(allocator); |
| 475 | defer result_buf.deinit(); | 475 | defer result_buf.deinit(); |
| 476 | 476 | ||
| 477 | const arch_sub_dir = switch (args.target.cpu.arch) { | 477 | const arch_sub_dir = switch (args.target.cpu.arch) { |
| ... | @@ -578,7 +578,7 @@ fn ccPrintFileName(args: CCPrintFileNameOptions) ![:0]u8 { | ... | @@ -578,7 +578,7 @@ fn ccPrintFileName(args: CCPrintFileNameOptions) ![:0]u8 { |
| 578 | break :blk false; | 578 | break :blk false; |
| 579 | }; | 579 | }; |
| 580 | 580 | ||
| 581 | var argv = std.ArrayList([]const u8).init(allocator); | 581 | var argv = std.array_list.Managed([]const u8).init(allocator); |
| 582 | defer argv.deinit(); | 582 | defer argv.deinit(); |
| 583 | 583 | ||
| 584 | const arg1 = try std.fmt.allocPrint(allocator, "-print-file-name={s}", .{args.search_basename}); | 584 | const arg1 = try std.fmt.allocPrint(allocator, "-print-file-name={s}", .{args.search_basename}); |
| ... | @@ -671,7 +671,7 @@ fn fillInstallations( | ... | @@ -671,7 +671,7 @@ fn fillInstallations( |
| 671 | 671 | ||
| 672 | const inf_loop_env_key = "ZIG_IS_DETECTING_LIBC_PATHS"; | 672 | const inf_loop_env_key = "ZIG_IS_DETECTING_LIBC_PATHS"; |
| 673 | 673 | ||
| 674 | fn appendCcExe(args: *std.ArrayList([]const u8), skip_cc_env_var: bool) !void { | 674 | fn appendCcExe(args: *std.array_list.Managed([]const u8), skip_cc_env_var: bool) !void { |
| 675 | const default_cc_exe = if (is_windows) "cc.exe" else "cc"; | 675 | const default_cc_exe = if (is_windows) "cc.exe" else "cc"; |
| 676 | try args.ensureUnusedCapacity(1); | 676 | try args.ensureUnusedCapacity(1); |
| 677 | if (skip_cc_env_var) { | 677 | if (skip_cc_env_var) { |
lib/std/zig/WindowsSdk.zig+10-10| ... | @@ -92,8 +92,8 @@ fn iterateAndFilterByVersion( | ... | @@ -92,8 +92,8 @@ fn iterateAndFilterByVersion( |
| 92 | std.mem.order(u8, lhs.build, rhs.build); | 92 | std.mem.order(u8, lhs.build, rhs.build); |
| 93 | } | 93 | } |
| 94 | }; | 94 | }; |
| 95 | var versions = std.ArrayList(Version).init(allocator); | 95 | var versions = std.array_list.Managed(Version).init(allocator); |
| 96 | var dirs = std.ArrayList([]const u8).init(allocator); | 96 | var dirs = std.array_list.Managed([]const u8).init(allocator); |
| 97 | defer { | 97 | defer { |
| 98 | versions.deinit(); | 98 | versions.deinit(); |
| 99 | for (dirs.items) |filtered_dir| allocator.free(filtered_dir); | 99 | for (dirs.items) |filtered_dir| allocator.free(filtered_dir); |
| ... | @@ -450,7 +450,7 @@ pub const Installation = struct { | ... | @@ -450,7 +450,7 @@ pub const Installation = struct { |
| 450 | return error.PathTooLong; | 450 | return error.PathTooLong; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 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); |
| 454 | errdefer path.deinit(); | 454 | errdefer path.deinit(); |
| 455 | 455 | ||
| 456 | // String might contain trailing slash, so trim it here | 456 | // String might contain trailing slash, so trim it here |
| ... | @@ -522,7 +522,7 @@ pub const Installation = struct { | ... | @@ -522,7 +522,7 @@ pub const Installation = struct { |
| 522 | return error.PathTooLong; | 522 | return error.PathTooLong; |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 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); |
| 526 | errdefer path.deinit(); | 526 | errdefer path.deinit(); |
| 527 | 527 | ||
| 528 | // String might contain trailing slash, so trim it here | 528 | // String might contain trailing slash, so trim it here |
| ... | @@ -548,7 +548,7 @@ pub const Installation = struct { | ... | @@ -548,7 +548,7 @@ pub const Installation = struct { |
| 548 | return error.VersionTooLong; | 548 | return error.VersionTooLong; |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | var version = std.ArrayList(u8).fromOwnedSlice(allocator, version_without_0); | 551 | var version = std.array_list.Managed(u8).fromOwnedSlice(allocator, version_without_0); |
| 552 | errdefer version.deinit(); | 552 | errdefer version.deinit(); |
| 553 | 553 | ||
| 554 | try version.appendSlice(".0"); | 554 | try version.appendSlice(".0"); |
| ... | @@ -802,7 +802,7 @@ const MsvcLibDir = struct { | ... | @@ -802,7 +802,7 @@ const MsvcLibDir = struct { |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | fn libDirFromInstallationPath(allocator: std.mem.Allocator, installation_path: []const u8, arch: std.Target.Cpu.Arch) error{ OutOfMemory, PathNotFound }![]const u8 { | 804 | 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); |
| 806 | errdefer lib_dir_buf.deinit(); | 806 | errdefer lib_dir_buf.deinit(); |
| 807 | 807 | ||
| 808 | lib_dir_buf.appendSliceAssumeCapacity(installation_path); | 808 | lib_dir_buf.appendSliceAssumeCapacity(installation_path); |
| ... | @@ -897,7 +897,7 @@ const MsvcLibDir = struct { | ... | @@ -897,7 +897,7 @@ const MsvcLibDir = struct { |
| 897 | return error.PathNotFound; | 897 | return error.PathNotFound; |
| 898 | } | 898 | } |
| 899 | 899 | ||
| 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); |
| 901 | errdefer msvc_dir.deinit(); | 901 | errdefer msvc_dir.deinit(); |
| 902 | 902 | ||
| 903 | // String might contain trailing slash, so trim it here | 903 | // String might contain trailing slash, so trim it here |
| ... | @@ -929,7 +929,7 @@ const MsvcLibDir = struct { | ... | @@ -929,7 +929,7 @@ const MsvcLibDir = struct { |
| 929 | } | 929 | } |
| 930 | 930 | ||
| 931 | fn findViaVs7Key(allocator: std.mem.Allocator, arch: std.Target.Cpu.Arch) error{ OutOfMemory, PathNotFound }![]const u8 { | 931 | 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: { |
| 933 | try_env: { | 933 | try_env: { |
| 934 | var env_map = std.process.getEnvMap(allocator) catch |err| switch (err) { | 934 | var env_map = std.process.getEnvMap(allocator) catch |err| switch (err) { |
| 935 | error.OutOfMemory => return error.OutOfMemory, | 935 | error.OutOfMemory => return error.OutOfMemory, |
| ... | @@ -940,7 +940,7 @@ const MsvcLibDir = struct { | ... | @@ -940,7 +940,7 @@ const MsvcLibDir = struct { |
| 940 | if (env_map.get("VS140COMNTOOLS")) |VS140COMNTOOLS| { | 940 | if (env_map.get("VS140COMNTOOLS")) |VS140COMNTOOLS| { |
| 941 | if (VS140COMNTOOLS.len < "C:\\Common7\\Tools".len) break :try_env; | 941 | if (VS140COMNTOOLS.len < "C:\\Common7\\Tools".len) break :try_env; |
| 942 | if (!std.fs.path.isAbsolute(VS140COMNTOOLS)) break :try_env; | 942 | 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); |
| 944 | errdefer list.deinit(); | 944 | errdefer list.deinit(); |
| 945 | 945 | ||
| 946 | try list.appendSlice(VS140COMNTOOLS); // C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools | 946 | try list.appendSlice(VS140COMNTOOLS); // C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools |
| ... | @@ -964,7 +964,7 @@ const MsvcLibDir = struct { | ... | @@ -964,7 +964,7 @@ const MsvcLibDir = struct { |
| 964 | break :try_vs7_key; | 964 | break :try_vs7_key; |
| 965 | } | 965 | } |
| 966 | 966 | ||
| 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); |
| 968 | errdefer path.deinit(); | 968 | errdefer path.deinit(); |
| 969 | 969 | ||
| 970 | // String might contain trailing slash, so trim it here | 970 | // 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 { | ... | @@ -60,7 +60,7 @@ pub const Record = struct { |
| 60 | blob: []const u8, | 60 | blob: []const u8, |
| 61 | 61 | ||
| 62 | fn toOwnedAbbrev(record: Record, allocator: std.mem.Allocator) !Abbrev { | 62 | 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); |
| 64 | defer operands.deinit(); | 64 | defer operands.deinit(); |
| 65 | 65 | ||
| 66 | assert(record.id == Abbrev.Builtin.define_abbrev.toRecordId()); | 66 | assert(record.id == Abbrev.Builtin.define_abbrev.toRecordId()); |
| ... | @@ -194,8 +194,8 @@ fn nextRecord(bc: *BitcodeReader) !?Record { | ... | @@ -194,8 +194,8 @@ fn nextRecord(bc: *BitcodeReader) !?Record { |
| 194 | defer bc.record_arena = record_arena.state; | 194 | defer bc.record_arena = record_arena.state; |
| 195 | _ = record_arena.reset(.retain_capacity); | 195 | _ = record_arena.reset(.retain_capacity); |
| 196 | 196 | ||
| 197 | var operands = try std.ArrayList(u64).initCapacity(record_arena.allocator(), abbrev.operands.len); | 197 | var operands = try std.array_list.Managed(u64).initCapacity(record_arena.allocator(), abbrev.operands.len); |
| 198 | var blob = std.ArrayList(u8).init(record_arena.allocator()); | 198 | var blob = std.array_list.Managed(u8).init(record_arena.allocator()); |
| 199 | for (abbrev.operands, 0..) |abbrev_operand, abbrev_operand_i| switch (abbrev_operand) { | 199 | for (abbrev.operands, 0..) |abbrev_operand, abbrev_operand_i| switch (abbrev_operand) { |
| 200 | .literal => |value| operands.appendAssumeCapacity(value), | 200 | .literal => |value| operands.appendAssumeCapacity(value), |
| 201 | .encoding => |abbrev_encoding| switch (abbrev_encoding) { | 201 | .encoding => |abbrev_encoding| switch (abbrev_encoding) { |
lib/std/zig/llvm/Builder.zig+2-2| ... | @@ -9107,7 +9107,7 @@ pub fn getIntrinsic( | ... | @@ -9107,7 +9107,7 @@ pub fn getIntrinsic( |
| 9107 | 9107 | ||
| 9108 | var attributes: struct { | 9108 | var attributes: struct { |
| 9109 | builder: *Builder, | 9109 | builder: *Builder, |
| 9110 | list: std.ArrayList(Attribute.Index), | 9110 | list: std.array_list.Managed(Attribute.Index), |
| 9111 | 9111 | ||
| 9112 | fn deinit(state: *@This()) void { | 9112 | fn deinit(state: *@This()) void { |
| 9113 | state.list.deinit(); | 9113 | state.list.deinit(); |
| ... | @@ -9120,7 +9120,7 @@ pub fn getIntrinsic( | ... | @@ -9120,7 +9120,7 @@ pub fn getIntrinsic( |
| 9120 | item.* = try state.builder.attr(attribute); | 9120 | item.* = try state.builder.attr(attribute); |
| 9121 | return state.builder.attrs(state.list.items); | 9121 | return state.builder.attrs(state.list.items); |
| 9122 | } | 9122 | } |
| 9123 | } = .{ .builder = self, .list = std.ArrayList(Attribute.Index).init(allocator) }; | 9123 | } = .{ .builder = self, .list = std.array_list.Managed(Attribute.Index).init(allocator) }; |
| 9124 | defer attributes.deinit(); | 9124 | defer attributes.deinit(); |
| 9125 | 9125 | ||
| 9126 | var overload_index: usize = 0; | 9126 | 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 { | ... | @@ -19,7 +19,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { |
| 19 | return struct { | 19 | return struct { |
| 20 | const BcWriter = @This(); | 20 | const BcWriter = @This(); |
| 21 | 21 | ||
| 22 | buffer: std.ArrayList(u32), | 22 | buffer: std.array_list.Managed(u32), |
| 23 | bit_buffer: u32 = 0, | 23 | bit_buffer: u32 = 0, |
| 24 | bit_count: u5 = 0, | 24 | bit_count: u5 = 0, |
| 25 | 25 | ||
| ... | @@ -31,7 +31,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { | ... | @@ -31,7 +31,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { |
| 31 | 31 | ||
| 32 | pub fn init(allocator: std.mem.Allocator, widths: [types.len]u16) BcWriter { | 32 | pub fn init(allocator: std.mem.Allocator, widths: [types.len]u16) BcWriter { |
| 33 | return .{ | 33 | return .{ |
| 34 | .buffer = std.ArrayList(u32).init(allocator), | 34 | .buffer = std.array_list.Managed(u32).init(allocator), |
| 35 | .widths = widths, | 35 | .widths = widths, |
| 36 | }; | 36 | }; |
| 37 | } | 37 | } |
src/Builtin.zig+2-2| ... | @@ -40,12 +40,12 @@ pub fn hash(opts: @This()) [std.Build.Cache.bin_digest_len]u8 { | ... | @@ -40,12 +40,12 @@ pub fn hash(opts: @This()) [std.Build.Cache.bin_digest_len]u8 { |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | pub fn generate(opts: @This(), allocator: Allocator) Allocator.Error![:0]u8 { | 42 | pub 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); |
| 44 | try append(opts, &buffer); | 44 | try append(opts, &buffer); |
| 45 | return buffer.toOwnedSliceSentinel(0); | 45 | return buffer.toOwnedSliceSentinel(0); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void { | 48 | pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Error!void { |
| 49 | const target = opts.target; | 49 | const target = opts.target; |
| 50 | const arch_family_name = @tagName(target.cpu.arch.family()); | 50 | const arch_family_name = @tagName(target.cpu.arch.family()); |
| 51 | const zig_backend = opts.zig_backend; | 51 | const zig_backend = opts.zig_backend; |
src/Compilation.zig+9-9| ... | @@ -3644,10 +3644,10 @@ pub fn saveState(comp: *Compilation) !void { | ... | @@ -3644,10 +3644,10 @@ pub fn saveState(comp: *Compilation) !void { |
| 3644 | 3644 | ||
| 3645 | const gpa = comp.gpa; | 3645 | const gpa = comp.gpa; |
| 3646 | 3646 | ||
| 3647 | var bufs = std.ArrayList([]const u8).init(gpa); | 3647 | var bufs = std.array_list.Managed([]const u8).init(gpa); |
| 3648 | defer bufs.deinit(); | 3648 | defer bufs.deinit(); |
| 3649 | 3649 | ||
| 3650 | var pt_headers = std.ArrayList(Header.PerThread).init(gpa); | 3650 | var pt_headers = std.array_list.Managed(Header.PerThread).init(gpa); |
| 3651 | defer pt_headers.deinit(); | 3651 | defer pt_headers.deinit(); |
| 3652 | 3652 | ||
| 3653 | if (comp.zcu) |zcu| { | 3653 | if (comp.zcu) |zcu| { |
| ... | @@ -3865,7 +3865,7 @@ pub fn saveState(comp: *Compilation) !void { | ... | @@ -3865,7 +3865,7 @@ pub fn saveState(comp: *Compilation) !void { |
| 3865 | try af.finish(); | 3865 | try af.finish(); |
| 3866 | } | 3866 | } |
| 3867 | 3867 | ||
| 3868 | fn addBuf(list: *std.ArrayList([]const u8), buf: []const u8) void { | 3868 | fn addBuf(list: *std.array_list.Managed([]const u8), buf: []const u8) void { |
| 3869 | if (buf.len == 0) return; | 3869 | if (buf.len == 0) return; |
| 3870 | list.appendAssumeCapacity(buf); | 3870 | list.appendAssumeCapacity(buf); |
| 3871 | } | 3871 | } |
| ... | @@ -5657,7 +5657,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module | ... | @@ -5657,7 +5657,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module |
| 5657 | log.info("C import source: {s}", .{out_h_path}); | 5657 | log.info("C import source: {s}", .{out_h_path}); |
| 5658 | } | 5658 | } |
| 5659 | 5659 | ||
| 5660 | var argv = std.ArrayList([]const u8).init(comp.gpa); | 5660 | var argv = std.array_list.Managed([]const u8).init(comp.gpa); |
| 5661 | defer argv.deinit(); | 5661 | defer argv.deinit(); |
| 5662 | 5662 | ||
| 5663 | try argv.append(@tagName(comp.config.c_frontend)); // argv[0] is program name, actual args start at [1] | 5663 | 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 | ... | @@ -6113,7 +6113,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr |
| 6113 | const target = comp.getTarget(); | 6113 | const target = comp.getTarget(); |
| 6114 | const o_ext = target.ofmt.fileExt(target.cpu.arch); | 6114 | const o_ext = target.ofmt.fileExt(target.cpu.arch); |
| 6115 | const digest = if (!comp.disable_c_depfile and try man.hit()) man.final() else blk: { | 6115 | 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); |
| 6117 | defer argv.deinit(); | 6117 | defer argv.deinit(); |
| 6118 | 6118 | ||
| 6119 | // In case we are doing passthrough mode, we need to detect -S and -emit-llvm. | 6119 | // 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 | ... | @@ -6458,7 +6458,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 6458 | 6458 | ||
| 6459 | try o_dir.writeFile(.{ .sub_path = rc_basename, .data = input }); | 6459 | try o_dir.writeFile(.{ .sub_path = rc_basename, .data = input }); |
| 6460 | 6460 | ||
| 6461 | var argv = std.ArrayList([]const u8).init(comp.gpa); | 6461 | var argv = std.array_list.Managed([]const u8).init(comp.gpa); |
| 6462 | defer argv.deinit(); | 6462 | defer argv.deinit(); |
| 6463 | 6463 | ||
| 6464 | try argv.appendSlice(&.{ | 6464 | try argv.appendSlice(&.{ |
| ... | @@ -6515,7 +6515,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -6515,7 +6515,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 6515 | // so we need a temporary filename. | 6515 | // so we need a temporary filename. |
| 6516 | const out_res_path = try comp.tmpFilePath(arena, res_filename); | 6516 | const out_res_path = try comp.tmpFilePath(arena, res_filename); |
| 6517 | 6517 | ||
| 6518 | var argv = std.ArrayList([]const u8).init(comp.gpa); | 6518 | var argv = std.array_list.Managed([]const u8).init(comp.gpa); |
| 6519 | defer argv.deinit(); | 6519 | defer argv.deinit(); |
| 6520 | 6520 | ||
| 6521 | const depfile_filename = try std.fmt.allocPrint(arena, "{s}.d.json", .{rc_basename_noext}); | 6521 | 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 | ... | @@ -6698,7 +6698,7 @@ pub fn tmpFilePath(comp: Compilation, ally: Allocator, suffix: []const u8) error |
| 6698 | pub fn addTranslateCCArgs( | 6698 | pub fn addTranslateCCArgs( |
| 6699 | comp: *Compilation, | 6699 | comp: *Compilation, |
| 6700 | arena: Allocator, | 6700 | arena: Allocator, |
| 6701 | argv: *std.ArrayList([]const u8), | 6701 | argv: *std.array_list.Managed([]const u8), |
| 6702 | ext: FileExt, | 6702 | ext: FileExt, |
| 6703 | out_dep_path: ?[]const u8, | 6703 | out_dep_path: ?[]const u8, |
| 6704 | owner_mod: *Package.Module, | 6704 | owner_mod: *Package.Module, |
| ... | @@ -6713,7 +6713,7 @@ pub fn addTranslateCCArgs( | ... | @@ -6713,7 +6713,7 @@ pub fn addTranslateCCArgs( |
| 6713 | pub fn addCCArgs( | 6713 | pub fn addCCArgs( |
| 6714 | comp: *const Compilation, | 6714 | comp: *const Compilation, |
| 6715 | arena: Allocator, | 6715 | arena: Allocator, |
| 6716 | argv: *std.ArrayList([]const u8), | 6716 | argv: *std.array_list.Managed([]const u8), |
| 6717 | ext: FileExt, | 6717 | ext: FileExt, |
| 6718 | out_dep_path: ?[]const u8, | 6718 | out_dep_path: ?[]const u8, |
| 6719 | mod: *Package.Module, | 6719 | mod: *Package.Module, |
src/Package/Fetch.zig+4-4| ... | @@ -173,7 +173,7 @@ pub const JobQueue = struct { | ... | @@ -173,7 +173,7 @@ pub const JobQueue = struct { |
| 173 | 173 | ||
| 174 | /// Creates the dependencies.zig source code for the build runner to obtain | 174 | /// Creates the dependencies.zig source code for the build runner to obtain |
| 175 | /// via `@import("@dependencies")`. | 175 | /// 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 { |
| 177 | const keys = jq.table.keys(); | 177 | const keys = jq.table.keys(); |
| 178 | 178 | ||
| 179 | assert(keys.len != 0); // caller should have added the first one | 179 | assert(keys.len != 0); // caller should have added the first one |
| ... | @@ -285,7 +285,7 @@ pub const JobQueue = struct { | ... | @@ -285,7 +285,7 @@ pub const JobQueue = struct { |
| 285 | try buf.appendSlice("};\n"); | 285 | try buf.appendSlice("};\n"); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | pub fn createEmptyDependenciesSource(buf: *std.ArrayList(u8)) Allocator.Error!void { | 288 | pub fn createEmptyDependenciesSource(buf: *std.array_list.Managed(u8)) Allocator.Error!void { |
| 289 | try buf.appendSlice( | 289 | try buf.appendSlice( |
| 290 | \\pub const packages = struct {}; | 290 | \\pub const packages = struct {}; |
| 291 | \\pub const root_deps: []const struct { []const u8, []const u8 } = &.{}; | 291 | \\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 | ... | @@ -1474,10 +1474,10 @@ fn computeHash(f: *Fetch, pkg_path: Cache.Path, filter: Filter) RunError!Compute |
| 1474 | const root_dir = pkg_path.root_dir.handle; | 1474 | const root_dir = pkg_path.root_dir.handle; |
| 1475 | 1475 | ||
| 1476 | // Collect all files, recursively, then sort. | 1476 | // 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); |
| 1478 | defer all_files.deinit(); | 1478 | defer all_files.deinit(); |
| 1479 | 1479 | ||
| 1480 | var deleted_files = std.ArrayList(*DeletedFile).init(gpa); | 1480 | var deleted_files = std.array_list.Managed(*DeletedFile).init(gpa); |
| 1481 | defer deleted_files.deinit(); | 1481 | defer deleted_files.deinit(); |
| 1482 | 1482 | ||
| 1483 | // Track directories which had any files deleted from them so that empty directories | 1483 | // 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 { | ... | @@ -336,8 +336,8 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 336 | if (resolved_target.llvm_cpu_features) |x| break :b x; | 336 | if (resolved_target.llvm_cpu_features) |x| break :b x; |
| 337 | if (!options.global.use_llvm) break :b null; | 337 | if (!options.global.use_llvm) break :b null; |
| 338 | 338 | ||
| 339 | var buf = std.ArrayList(u8).init(arena); | 339 | var buf = std.array_list.Managed(u8).init(arena); |
| 340 | var disabled_features = std.ArrayList(u8).init(arena); | 340 | var disabled_features = std.array_list.Managed(u8).init(arena); |
| 341 | defer disabled_features.deinit(); | 341 | defer disabled_features.deinit(); |
| 342 | 342 | ||
| 343 | // Append disabled features after enabled ones, so that their effects aren't overwritten. | 343 | // 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(); | ... | @@ -10,7 +10,7 @@ const RangeSet = @This(); |
| 10 | const LazySrcLoc = Zcu.LazySrcLoc; | 10 | const LazySrcLoc = Zcu.LazySrcLoc; |
| 11 | 11 | ||
| 12 | zcu: *Zcu, | 12 | zcu: *Zcu, |
| 13 | ranges: std.ArrayList(Range), | 13 | ranges: std.array_list.Managed(Range), |
| 14 | 14 | ||
| 15 | pub const Range = struct { | 15 | pub const Range = struct { |
| 16 | first: InternPool.Index, | 16 | first: InternPool.Index, |
| ... | @@ -21,7 +21,7 @@ pub const Range = struct { | ... | @@ -21,7 +21,7 @@ pub const Range = struct { |
| 21 | pub fn init(allocator: std.mem.Allocator, zcu: *Zcu) RangeSet { | 21 | pub fn init(allocator: std.mem.Allocator, zcu: *Zcu) RangeSet { |
| 22 | return .{ | 22 | return .{ |
| 23 | .zcu = zcu, | 23 | .zcu = zcu, |
| 24 | .ranges = std.ArrayList(Range).init(allocator), | 24 | .ranges = std.array_list.Managed(Range).init(allocator), |
| 25 | }; | 25 | }; |
| 26 | } | 26 | } |
| 27 | 27 |
src/Sema.zig+9-9| ... | @@ -63,7 +63,7 @@ func_index: InternPool.Index, | ... | @@ -63,7 +63,7 @@ func_index: InternPool.Index, |
| 63 | func_is_naked: bool, | 63 | func_is_naked: bool, |
| 64 | /// Used to restore the error return trace when returning a non-error from a function. | 64 | /// Used to restore the error return trace when returning a non-error from a function. |
| 65 | error_return_trace_index_on_fn_entry: Air.Inst.Ref = .none, | 65 | error_return_trace_index_on_fn_entry: Air.Inst.Ref = .none, |
| 66 | comptime_err_ret_trace: *std.ArrayList(LazySrcLoc), | 66 | comptime_err_ret_trace: *std.array_list.Managed(LazySrcLoc), |
| 67 | /// When semantic analysis needs to know the return type of the function whose body | 67 | /// When semantic analysis needs to know the return type of the function whose body |
| 68 | /// is being analyzed, this `Type` should be used instead of going through `func`. | 68 | /// is being analyzed, this `Type` should be used instead of going through `func`. |
| 69 | /// This will correctly handle the case of a comptime/inline function call of a | 69 | /// This will correctly handle the case of a comptime/inline function call of a |
| ... | @@ -376,7 +376,7 @@ pub const Block = struct { | ... | @@ -376,7 +376,7 @@ pub const Block = struct { |
| 376 | /// What mode to generate float operations in, set by @setFloatMode | 376 | /// What mode to generate float operations in, set by @setFloatMode |
| 377 | float_mode: std.builtin.FloatMode = .strict, | 377 | float_mode: std.builtin.FloatMode = .strict, |
| 378 | 378 | ||
| 379 | c_import_buf: ?*std.ArrayList(u8) = null, | 379 | c_import_buf: ?*std.array_list.Managed(u8) = null, |
| 380 | 380 | ||
| 381 | /// If not `null`, this boolean is set when a `dbg_var_ptr`, `dbg_var_val`, or `dbg_arg_inline`. | 381 | /// If not `null`, this boolean is set when a `dbg_var_ptr`, `dbg_var_val`, or `dbg_arg_inline`. |
| 382 | /// instruction is emitted. It signals that the innermost lexically | 382 | /// instruction is emitted. It signals that the innermost lexically |
| ... | @@ -3931,7 +3931,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, | ... | @@ -3931,7 +3931,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3931 | 3931 | ||
| 3932 | // Whilst constructing our mapping, we will also initialize optional and error union payloads when | 3932 | // Whilst constructing our mapping, we will also initialize optional and error union payloads when |
| 3933 | // we encounter the corresponding pointers. For this reason, the ordering of `to_map` matters. | 3933 | // 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); |
| 3935 | 3935 | ||
| 3936 | for (stores) |store_inst_idx| { | 3936 | for (stores) |store_inst_idx| { |
| 3937 | const store_inst = sema.air_instructions.get(@intFromEnum(store_inst_idx)); | 3937 | 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 | ... | @@ -5665,7 +5665,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr |
| 5665 | if (!build_options.have_llvm) | 5665 | if (!build_options.have_llvm) |
| 5666 | return sema.fail(parent_block, src, "C import unavailable; Zig compiler built without LLVM extensions", .{}); | 5666 | return sema.fail(parent_block, src, "C import unavailable; Zig compiler built without LLVM extensions", .{}); |
| 5667 | 5667 | ||
| 5668 | var c_import_buf = std.ArrayList(u8).init(gpa); | 5668 | var c_import_buf = std.array_list.Managed(u8).init(gpa); |
| 5669 | defer c_import_buf.deinit(); | 5669 | defer c_import_buf.deinit(); |
| 5670 | 5670 | ||
| 5671 | var child_block: Block = .{ | 5671 | var child_block: Block = .{ |
| ... | @@ -10701,7 +10701,7 @@ const SwitchProngAnalysis = struct { | ... | @@ -10701,7 +10701,7 @@ const SwitchProngAnalysis = struct { |
| 10701 | const prong_count = field_indices.len - in_mem_coercible.count(); | 10701 | const prong_count = field_indices.len - in_mem_coercible.count(); |
| 10702 | 10702 | ||
| 10703 | const estimated_extra = prong_count * 6 + (prong_count / 10); // 2 for Case, 1 item, probably 3 insts; plus hints | 10703 | 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); |
| 10705 | defer cases_extra.deinit(); | 10705 | defer cases_extra.deinit(); |
| 10706 | 10706 | ||
| 10707 | { | 10707 | { |
| ... | @@ -17603,7 +17603,7 @@ fn typeInfoDecls( | ... | @@ -17603,7 +17603,7 @@ fn typeInfoDecls( |
| 17603 | 17603 | ||
| 17604 | const declaration_ty = try sema.getBuiltinType(src, .@"Type.Declaration"); | 17604 | const declaration_ty = try sema.getBuiltinType(src, .@"Type.Declaration"); |
| 17605 | 17605 | ||
| 17606 | var decl_vals = std.ArrayList(InternPool.Index).init(gpa); | 17606 | var decl_vals = std.array_list.Managed(InternPool.Index).init(gpa); |
| 17607 | defer decl_vals.deinit(); | 17607 | defer decl_vals.deinit(); |
| 17608 | 17608 | ||
| 17609 | var seen_namespaces = std.AutoHashMap(*Namespace, void).init(gpa); | 17609 | var seen_namespaces = std.AutoHashMap(*Namespace, void).init(gpa); |
| ... | @@ -17645,7 +17645,7 @@ fn typeInfoNamespaceDecls( | ... | @@ -17645,7 +17645,7 @@ fn typeInfoNamespaceDecls( |
| 17645 | sema: *Sema, | 17645 | sema: *Sema, |
| 17646 | opt_namespace_index: InternPool.OptionalNamespaceIndex, | 17646 | opt_namespace_index: InternPool.OptionalNamespaceIndex, |
| 17647 | declaration_ty: Type, | 17647 | declaration_ty: Type, |
| 17648 | decl_vals: *std.ArrayList(InternPool.Index), | 17648 | decl_vals: *std.array_list.Managed(InternPool.Index), |
| 17649 | seen_namespaces: *std.AutoHashMap(*Namespace, void), | 17649 | seen_namespaces: *std.AutoHashMap(*Namespace, void), |
| 17650 | ) !void { | 17650 | ) !void { |
| 17651 | const pt = sema.pt; | 17651 | const pt = sema.pt; |
| ... | @@ -29670,7 +29670,7 @@ fn coerceInMemoryAllowedErrorSets( | ... | @@ -29670,7 +29670,7 @@ fn coerceInMemoryAllowedErrorSets( |
| 29670 | } | 29670 | } |
| 29671 | } | 29671 | } |
| 29672 | 29672 | ||
| 29673 | var missing_error_buf = std.ArrayList(InternPool.NullTerminatedString).init(gpa); | 29673 | var missing_error_buf = std.array_list.Managed(InternPool.NullTerminatedString).init(gpa); |
| 29674 | defer missing_error_buf.deinit(); | 29674 | defer missing_error_buf.deinit(); |
| 29675 | 29675 | ||
| 29676 | switch (src_ty.toIntern()) { | 29676 | switch (src_ty.toIntern()) { |
| ... | @@ -37151,7 +37151,7 @@ pub fn resolveDeclaredEnum( | ... | @@ -37151,7 +37151,7 @@ pub fn resolveDeclaredEnum( |
| 37151 | var arena: std.heap.ArenaAllocator = .init(gpa); | 37151 | var arena: std.heap.ArenaAllocator = .init(gpa); |
| 37152 | defer arena.deinit(); | 37152 | defer arena.deinit(); |
| 37153 | 37153 | ||
| 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); |
| 37155 | defer comptime_err_ret_trace.deinit(); | 37155 | defer comptime_err_ret_trace.deinit(); |
| 37156 | 37156 | ||
| 37157 | var sema: Sema = .{ | 37157 | var sema: Sema = .{ |
src/Sema/bitcast.zig+3-3| ... | @@ -102,7 +102,7 @@ fn bitCastInner( | ... | @@ -102,7 +102,7 @@ fn bitCastInner( |
| 102 | .arena = sema.arena, | 102 | .arena = sema.arena, |
| 103 | .skip_bits = skip_bits, | 103 | .skip_bits = skip_bits, |
| 104 | .remaining_bits = dest_ty.bitSize(zcu), | 104 | .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), |
| 106 | }; | 106 | }; |
| 107 | switch (endian) { | 107 | switch (endian) { |
| 108 | .little => { | 108 | .little => { |
| ... | @@ -163,7 +163,7 @@ fn bitCastSpliceInner( | ... | @@ -163,7 +163,7 @@ fn bitCastSpliceInner( |
| 163 | .arena = sema.arena, | 163 | .arena = sema.arena, |
| 164 | .skip_bits = 0, | 164 | .skip_bits = 0, |
| 165 | .remaining_bits = splice_offset, | 165 | .remaining_bits = splice_offset, |
| 166 | .unpacked = std.ArrayList(InternPool.Index).init(sema.arena), | 166 | .unpacked = std.array_list.Managed(InternPool.Index).init(sema.arena), |
| 167 | }; | 167 | }; |
| 168 | switch (endian) { | 168 | switch (endian) { |
| 169 | .little => { | 169 | .little => { |
| ... | @@ -216,7 +216,7 @@ const UnpackValueBits = struct { | ... | @@ -216,7 +216,7 @@ const UnpackValueBits = struct { |
| 216 | skip_bits: u64, | 216 | skip_bits: u64, |
| 217 | remaining_bits: u64, | 217 | remaining_bits: u64, |
| 218 | extra_bits: u64 = undefined, | 218 | extra_bits: u64 = undefined, |
| 219 | unpacked: std.ArrayList(InternPool.Index), | 219 | unpacked: std.array_list.Managed(InternPool.Index), |
| 220 | 220 | ||
| 221 | fn add(unpack: *UnpackValueBits, val: Value) BitCastError!void { | 221 | fn add(unpack: *UnpackValueBits, val: Value) BitCastError!void { |
| 222 | const pt = unpack.pt; | 222 | const pt = unpack.pt; |
src/Type.zig+2-2| ... | @@ -3805,7 +3805,7 @@ fn resolveStructInner( | ... | @@ -3805,7 +3805,7 @@ fn resolveStructInner( |
| 3805 | var analysis_arena = std.heap.ArenaAllocator.init(gpa); | 3805 | var analysis_arena = std.heap.ArenaAllocator.init(gpa); |
| 3806 | defer analysis_arena.deinit(); | 3806 | defer analysis_arena.deinit(); |
| 3807 | 3807 | ||
| 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); |
| 3809 | defer comptime_err_ret_trace.deinit(); | 3809 | defer comptime_err_ret_trace.deinit(); |
| 3810 | 3810 | ||
| 3811 | const zir = zcu.namespacePtr(struct_obj.namespace).fileScope(zcu).zir.?; | 3811 | const zir = zcu.namespacePtr(struct_obj.namespace).fileScope(zcu).zir.?; |
| ... | @@ -3864,7 +3864,7 @@ fn resolveUnionInner( | ... | @@ -3864,7 +3864,7 @@ fn resolveUnionInner( |
| 3864 | var analysis_arena = std.heap.ArenaAllocator.init(gpa); | 3864 | var analysis_arena = std.heap.ArenaAllocator.init(gpa); |
| 3865 | defer analysis_arena.deinit(); | 3865 | defer analysis_arena.deinit(); |
| 3866 | 3866 | ||
| 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); |
| 3868 | defer comptime_err_ret_trace.deinit(); | 3868 | defer comptime_err_ret_trace.deinit(); |
| 3869 | 3869 | ||
| 3870 | const zir = zcu.namespacePtr(union_obj.namespace).fileScope(zcu).zir.?; | 3870 | 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) | ... | @@ -727,7 +727,7 @@ fn analyzeMemoizedState(pt: Zcu.PerThread, stage: InternPool.MemoizedStateStage) |
| 727 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); | 727 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); |
| 728 | defer analysis_arena.deinit(); | 728 | defer analysis_arena.deinit(); |
| 729 | 729 | ||
| 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); |
| 731 | defer comptime_err_ret_trace.deinit(); | 731 | defer comptime_err_ret_trace.deinit(); |
| 732 | 732 | ||
| 733 | var sema: Sema = .{ | 733 | var sema: Sema = .{ |
| ... | @@ -870,7 +870,7 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu | ... | @@ -870,7 +870,7 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu |
| 870 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); | 870 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); |
| 871 | defer analysis_arena.deinit(); | 871 | defer analysis_arena.deinit(); |
| 872 | 872 | ||
| 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); |
| 874 | defer comptime_err_ret_trace.deinit(); | 874 | defer comptime_err_ret_trace.deinit(); |
| 875 | 875 | ||
| 876 | var sema: Sema = .{ | 876 | var sema: Sema = .{ |
| ... | @@ -1097,7 +1097,7 @@ fn analyzeNavVal(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileErr | ... | @@ -1097,7 +1097,7 @@ fn analyzeNavVal(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileErr |
| 1097 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); | 1097 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); |
| 1098 | defer analysis_arena.deinit(); | 1098 | defer analysis_arena.deinit(); |
| 1099 | 1099 | ||
| 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); |
| 1101 | defer comptime_err_ret_trace.deinit(); | 1101 | defer comptime_err_ret_trace.deinit(); |
| 1102 | 1102 | ||
| 1103 | var sema: Sema = .{ | 1103 | var sema: Sema = .{ |
| ... | @@ -1471,7 +1471,7 @@ fn analyzeNavType(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileEr | ... | @@ -1471,7 +1471,7 @@ fn analyzeNavType(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileEr |
| 1471 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); | 1471 | var analysis_arena: std.heap.ArenaAllocator = .init(gpa); |
| 1472 | defer analysis_arena.deinit(); | 1472 | defer analysis_arena.deinit(); |
| 1473 | 1473 | ||
| 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); |
| 1475 | defer comptime_err_ret_trace.deinit(); | 1475 | defer comptime_err_ret_trace.deinit(); |
| 1476 | 1476 | ||
| 1477 | var sema: Sema = .{ | 1477 | var sema: Sema = .{ |
| ... | @@ -2807,7 +2807,7 @@ fn analyzeFnBodyInner(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaE | ... | @@ -2807,7 +2807,7 @@ fn analyzeFnBodyInner(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaE |
| 2807 | var analysis_arena = std.heap.ArenaAllocator.init(gpa); | 2807 | var analysis_arena = std.heap.ArenaAllocator.init(gpa); |
| 2808 | defer analysis_arena.deinit(); | 2808 | defer analysis_arena.deinit(); |
| 2809 | 2809 | ||
| 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); |
| 2811 | defer comptime_err_ret_trace.deinit(); | 2811 | defer comptime_err_ret_trace.deinit(); |
| 2812 | 2812 | ||
| 2813 | // In the case of a generic function instance, this is the type of the | 2813 | // 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, | ... | @@ -101,7 +101,7 @@ reused_operands: std.StaticBitSet(Air.Liveness.bpi - 1) = undefined, |
| 101 | /// within different branches. Special consideration is needed when a branch | 101 | /// within different branches. Special consideration is needed when a branch |
| 102 | /// joins with its parent, to make sure all instructions have the same MCValue | 102 | /// joins with its parent, to make sure all instructions have the same MCValue |
| 103 | /// across each runtime branch upon joining. | 103 | /// across each runtime branch upon joining. |
| 104 | branch_stack: *std.ArrayList(Branch), | 104 | branch_stack: *std.array_list.Managed(Branch), |
| 105 | 105 | ||
| 106 | // Currently set vector properties, null means they haven't been set yet in the function. | 106 | // Currently set vector properties, null means they haven't been set yet in the function. |
| 107 | avl: ?u64, | 107 | avl: ?u64, |
| ... | @@ -674,7 +674,7 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt | ... | @@ -674,7 +674,7 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt |
| 674 | var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) = | 674 | var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) = |
| 675 | if (opts.update_tracking) {} else std.heap.stackFallback(@sizeOf(ExpectedContents), func.gpa); | 675 | if (opts.update_tracking) {} else std.heap.stackFallback(@sizeOf(ExpectedContents), func.gpa); |
| 676 | 676 | ||
| 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( |
| 678 | stack.get(), | 678 | stack.get(), |
| 679 | @typeInfo(ExpectedContents).array.len, | 679 | @typeInfo(ExpectedContents).array.len, |
| 680 | ); | 680 | ); |
| ... | @@ -753,7 +753,7 @@ pub fn generate( | ... | @@ -753,7 +753,7 @@ pub fn generate( |
| 753 | const fn_type = Type.fromInterned(func.ty); | 753 | const fn_type = Type.fromInterned(func.ty); |
| 754 | const mod = zcu.navFileScope(func.owner_nav).mod.?; | 754 | const mod = zcu.navFileScope(func.owner_nav).mod.?; |
| 755 | 755 | ||
| 756 | var branch_stack = std.ArrayList(Branch).init(gpa); | 756 | var branch_stack = std.array_list.Managed(Branch).init(gpa); |
| 757 | defer { | 757 | defer { |
| 758 | assert(branch_stack.items.len == 1); | 758 | assert(branch_stack.items.len == 1); |
| 759 | branch_stack.items[0].deinit(gpa); | 759 | branch_stack.items[0].deinit(gpa); |
| ... | @@ -4883,7 +4883,7 @@ fn genCall( | ... | @@ -4883,7 +4883,7 @@ fn genCall( |
| 4883 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); | 4883 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); |
| 4884 | } | 4884 | } |
| 4885 | 4885 | ||
| 4886 | var reg_locks = std.ArrayList(?RegisterLock).init(allocator); | 4886 | var reg_locks = std.array_list.Managed(?RegisterLock).init(allocator); |
| 4887 | defer reg_locks.deinit(); | 4887 | defer reg_locks.deinit(); |
| 4888 | try reg_locks.ensureTotalCapacity(8); | 4888 | try reg_locks.ensureTotalCapacity(8); |
| 4889 | defer for (reg_locks.items) |reg_lock| if (reg_lock) |lock| func.register_manager.unlockReg(lock); | 4889 | 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 { | ... | @@ -6056,7 +6056,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { |
| 6056 | extra_i += inputs.len; | 6056 | extra_i += inputs.len; |
| 6057 | 6057 | ||
| 6058 | var result: MCValue = .none; | 6058 | var result: MCValue = .none; |
| 6059 | var args = std.ArrayList(MCValue).init(func.gpa); | 6059 | var args = std.array_list.Managed(MCValue).init(func.gpa); |
| 6060 | try args.ensureTotalCapacity(outputs.len + inputs.len); | 6060 | try args.ensureTotalCapacity(outputs.len + inputs.len); |
| 6061 | defer { | 6061 | defer { |
| 6062 | for (args.items) |arg| if (arg.getReg()) |reg| func.register_manager.unlockReg(.{ | 6062 | 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, | ... | @@ -88,7 +88,7 @@ reused_operands: std.StaticBitSet(Air.Liveness.bpi - 1) = undefined, |
| 88 | /// within different branches. Special consideration is needed when a branch | 88 | /// within different branches. Special consideration is needed when a branch |
| 89 | /// joins with its parent, to make sure all instructions have the same MCValue | 89 | /// joins with its parent, to make sure all instructions have the same MCValue |
| 90 | /// across each runtime branch upon joining. | 90 | /// across each runtime branch upon joining. |
| 91 | branch_stack: *std.ArrayList(Branch), | 91 | branch_stack: *std.array_list.Managed(Branch), |
| 92 | 92 | ||
| 93 | // Key is the block instruction | 93 | // Key is the block instruction |
| 94 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, | 94 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| ... | @@ -276,7 +276,7 @@ pub fn generate( | ... | @@ -276,7 +276,7 @@ pub fn generate( |
| 276 | const file_scope = zcu.navFileScope(func.owner_nav); | 276 | const file_scope = zcu.navFileScope(func.owner_nav); |
| 277 | const target = &file_scope.mod.?.resolved_target.result; | 277 | const target = &file_scope.mod.?.resolved_target.result; |
| 278 | 278 | ||
| 279 | var branch_stack = std.ArrayList(Branch).init(gpa); | 279 | var branch_stack = std.array_list.Managed(Branch).init(gpa); |
| 280 | defer { | 280 | defer { |
| 281 | assert(branch_stack.items.len == 1); | 281 | assert(branch_stack.items.len == 1); |
| 282 | branch_stack.items[0].deinit(gpa); | 282 | branch_stack.items[0].deinit(gpa); |
src/arch/wasm/CodeGen.zig+2-2| ... | @@ -1301,7 +1301,7 @@ fn resolveCallingConventionValues( | ... | @@ -1301,7 +1301,7 @@ fn resolveCallingConventionValues( |
| 1301 | }; | 1301 | }; |
| 1302 | if (cc == .naked) return result; | 1302 | if (cc == .naked) return result; |
| 1303 | 1303 | ||
| 1304 | var args = std.ArrayList(WValue).init(gpa); | 1304 | var args = std.array_list.Managed(WValue).init(gpa); |
| 1305 | defer args.deinit(); | 1305 | defer args.deinit(); |
| 1306 | 1306 | ||
| 1307 | // Check if we store the result as a pointer to the stack rather than | 1307 | // 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 { | ... | @@ -7132,7 +7132,7 @@ fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7132 | const result = try cg.allocLocal(Type.bool); | 7132 | const result = try cg.allocLocal(Type.bool); |
| 7133 | 7133 | ||
| 7134 | const names = error_set_ty.errorSetNames(zcu); | 7134 | 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); |
| 7136 | defer values.deinit(); | 7136 | defer values.deinit(); |
| 7137 | 7137 | ||
| 7138 | var lowest: ?u32 = null; | 7138 | 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 | ... | @@ -169359,7 +169359,7 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co |
| 169359 | var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) = | 169359 | var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) = |
| 169360 | if (opts.update_tracking) {} else std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa); | 169360 | if (opts.update_tracking) {} else std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa); |
| 169361 | 169361 | ||
| 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( |
| 169363 | stack.get(), | 169363 | stack.get(), |
| 169364 | @typeInfo(ExpectedContents).array.len, | 169364 | @typeInfo(ExpectedContents).array.len, |
| 169365 | ); | 169365 | ); |
| ... | @@ -178175,7 +178175,7 @@ fn genCall(self: *CodeGen, info: union(enum) { | ... | @@ -178175,7 +178175,7 @@ fn genCall(self: *CodeGen, info: union(enum) { |
| 178175 | const frame_indices = try allocator.alloc(FrameIndex, args.len); | 178175 | const frame_indices = try allocator.alloc(FrameIndex, args.len); |
| 178176 | defer allocator.free(frame_indices); | 178176 | defer allocator.free(frame_indices); |
| 178177 | 178177 | ||
| 178178 | var reg_locks: std.ArrayList(?RegisterLock) = .init(allocator); | 178178 | var reg_locks: std.array_list.Managed(?RegisterLock) = .init(allocator); |
| 178179 | defer reg_locks.deinit(); | 178179 | defer reg_locks.deinit(); |
| 178180 | try reg_locks.ensureTotalCapacity(16); | 178180 | try reg_locks.ensureTotalCapacity(16); |
| 178181 | defer for (reg_locks.items) |reg_lock| if (reg_lock) |lock| self.register_manager.unlockReg(lock); | 178181 | 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 { | ... | @@ -179786,7 +179786,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 179786 | extra_i += inputs.len; | 179786 | extra_i += inputs.len; |
| 179787 | 179787 | ||
| 179788 | var result: MCValue = .none; | 179788 | var result: MCValue = .none; |
| 179789 | var args: std.ArrayList(MCValue) = .init(self.gpa); | 179789 | var args: std.array_list.Managed(MCValue) = .init(self.gpa); |
| 179790 | try args.ensureTotalCapacity(outputs.len + inputs.len); | 179790 | try args.ensureTotalCapacity(outputs.len + inputs.len); |
| 179791 | defer { | 179791 | defer { |
| 179792 | for (args.items) |arg| if (arg.getReg()) |reg| self.register_manager.unlockReg(.{ | 179792 | 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 { | ... | @@ -1216,7 +1216,7 @@ const TestEncode = struct { |
| 1216 | }; | 1216 | }; |
| 1217 | 1217 | ||
| 1218 | test "encode" { | 1218 | test "encode" { |
| 1219 | var buf = std.ArrayList(u8).init(testing.allocator); | 1219 | var buf = std.array_list.Managed(u8).init(testing.allocator); |
| 1220 | defer buf.deinit(); | 1220 | defer buf.deinit(); |
| 1221 | 1221 | ||
| 1222 | const inst: Instruction = try .new(.none, .mov, &.{ | 1222 | const inst: Instruction = try .new(.none, .mov, &.{ |
| ... | @@ -2647,7 +2647,7 @@ test "assemble" { | ... | @@ -2647,7 +2647,7 @@ test "assemble" { |
| 2647 | // zig fmt: on | 2647 | // zig fmt: on |
| 2648 | 2648 | ||
| 2649 | var as = Assembler.init(input); | 2649 | 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); |
| 2651 | defer output.deinit(); | 2651 | defer output.deinit(); |
| 2652 | try as.assemble(output.writer()); | 2652 | try as.assemble(output.writer()); |
| 2653 | try expectEqualHexStrings(expected, output.items, input); | 2653 | try expectEqualHexStrings(expected, output.items, input); |
| ... | @@ -2691,7 +2691,7 @@ test "assemble - Jcc" { | ... | @@ -2691,7 +2691,7 @@ test "assemble - Jcc" { |
| 2691 | const input = @tagName(mnemonic[0]) ++ " 0x0"; | 2691 | const input = @tagName(mnemonic[0]) ++ " 0x0"; |
| 2692 | const expected = [_]u8{ 0x0f, mnemonic[1], 0x0, 0x0, 0x0, 0x0 }; | 2692 | const expected = [_]u8{ 0x0f, mnemonic[1], 0x0, 0x0, 0x0, 0x0 }; |
| 2693 | var as = Assembler.init(input); | 2693 | 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); |
| 2695 | defer output.deinit(); | 2695 | defer output.deinit(); |
| 2696 | try as.assemble(output.writer()); | 2696 | try as.assemble(output.writer()); |
| 2697 | try expectEqualHexStrings(&expected, output.items, input); | 2697 | try expectEqualHexStrings(&expected, output.items, input); |
| ... | @@ -2736,7 +2736,7 @@ test "assemble - SETcc" { | ... | @@ -2736,7 +2736,7 @@ test "assemble - SETcc" { |
| 2736 | const input = @tagName(mnemonic[0]) ++ " al"; | 2736 | const input = @tagName(mnemonic[0]) ++ " al"; |
| 2737 | const expected = [_]u8{ 0x0f, mnemonic[1], 0xC0 }; | 2737 | const expected = [_]u8{ 0x0f, mnemonic[1], 0xC0 }; |
| 2738 | var as = Assembler.init(input); | 2738 | 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); |
| 2740 | defer output.deinit(); | 2740 | defer output.deinit(); |
| 2741 | try as.assemble(output.writer()); | 2741 | try as.assemble(output.writer()); |
| 2742 | try expectEqualHexStrings(&expected, output.items, input); | 2742 | try expectEqualHexStrings(&expected, output.items, input); |
| ... | @@ -2781,7 +2781,7 @@ test "assemble - CMOVcc" { | ... | @@ -2781,7 +2781,7 @@ test "assemble - CMOVcc" { |
| 2781 | const input = @tagName(mnemonic[0]) ++ " rax, rbx"; | 2781 | const input = @tagName(mnemonic[0]) ++ " rax, rbx"; |
| 2782 | const expected = [_]u8{ 0x48, 0x0f, mnemonic[1], 0xC3 }; | 2782 | const expected = [_]u8{ 0x48, 0x0f, mnemonic[1], 0xC3 }; |
| 2783 | var as = Assembler.init(input); | 2783 | 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); |
| 2785 | defer output.deinit(); | 2785 | defer output.deinit(); |
| 2786 | try as.assemble(output.writer()); | 2786 | try as.assemble(output.writer()); |
| 2787 | try expectEqualHexStrings(&expected, output.items, input); | 2787 | 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 | ... | @@ -53,7 +53,7 @@ fn subArchName(target: *const std.Target, comptime family: std.Target.Cpu.Arch.F |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 { | 55 | pub 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); |
| 57 | defer llvm_triple.deinit(); | 57 | defer llvm_triple.deinit(); |
| 58 | 58 | ||
| 59 | const llvm_arch = switch (target.cpu.arch) { | 59 | const llvm_arch = switch (target.cpu.arch) { |
| ... | @@ -820,7 +820,7 @@ pub const Object = struct { | ... | @@ -820,7 +820,7 @@ pub const Object = struct { |
| 820 | } | 820 | } |
| 821 | 821 | ||
| 822 | { | 822 | { |
| 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); |
| 824 | defer module_flags.deinit(); | 824 | defer module_flags.deinit(); |
| 825 | 825 | ||
| 826 | const behavior_error = try o.builder.metadataConstant(try o.builder.intConst(.i32, 1)); | 826 | const behavior_error = try o.builder.metadataConstant(try o.builder.intConst(.i32, 1)); |
| ... | @@ -2583,7 +2583,7 @@ pub const Object = struct { | ... | @@ -2583,7 +2583,7 @@ pub const Object = struct { |
| 2583 | .@"fn" => { | 2583 | .@"fn" => { |
| 2584 | const fn_info = zcu.typeToFunc(ty).?; | 2584 | const fn_info = zcu.typeToFunc(ty).?; |
| 2585 | 2585 | ||
| 2586 | var debug_param_types = std.ArrayList(Builder.Metadata).init(gpa); | 2586 | var debug_param_types = std.array_list.Managed(Builder.Metadata).init(gpa); |
| 2587 | defer debug_param_types.deinit(); | 2587 | defer debug_param_types.deinit(); |
| 2588 | 2588 | ||
| 2589 | try debug_param_types.ensureUnusedCapacity(3 + fn_info.param_types.len); | 2589 | try debug_param_types.ensureUnusedCapacity(3 + fn_info.param_types.len); |
| ... | @@ -5254,7 +5254,7 @@ pub const FuncGen = struct { | ... | @@ -5254,7 +5254,7 @@ pub const FuncGen = struct { |
| 5254 | const target = zcu.getTarget(); | 5254 | const target = zcu.getTarget(); |
| 5255 | const sret = firstParamSRet(fn_info, zcu, target); | 5255 | const sret = firstParamSRet(fn_info, zcu, target); |
| 5256 | 5256 | ||
| 5257 | var llvm_args = std.ArrayList(Builder.Value).init(self.gpa); | 5257 | var llvm_args = std.array_list.Managed(Builder.Value).init(self.gpa); |
| 5258 | defer llvm_args.deinit(); | 5258 | defer llvm_args.deinit(); |
| 5259 | 5259 | ||
| 5260 | var attributes: Builder.FunctionAttributes.Wip = .{}; | 5260 | var attributes: Builder.FunctionAttributes.Wip = .{}; |
| ... | @@ -7536,7 +7536,7 @@ pub const FuncGen = struct { | ... | @@ -7536,7 +7536,7 @@ pub const FuncGen = struct { |
| 7536 | const asm_source = std.mem.sliceAsBytes(self.air.extra.items[extra_i..])[0..extra.data.source_len]; | 7536 | const asm_source = std.mem.sliceAsBytes(self.air.extra.items[extra_i..])[0..extra.data.source_len]; |
| 7537 | 7537 | ||
| 7538 | // hackety hacks until stage2 has proper inline asm in the frontend. | 7538 | // 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); |
| 7540 | defer rendered_template.deinit(); | 7540 | defer rendered_template.deinit(); |
| 7541 | 7541 | ||
| 7542 | const State = enum { start, percent, input, modifier }; | 7542 | 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 { | ... | @@ -970,10 +970,10 @@ fn constant(cg: *CodeGen, ty: Type, val: Value, repr: Repr) Error!Id { |
| 970 | return try cg.constInt(backing_ty, @as(u64, @bitCast(limbs))); | 970 | return try cg.constInt(backing_ty, @as(u64, @bitCast(limbs))); |
| 971 | } | 971 | } |
| 972 | 972 | ||
| 973 | var types = std.ArrayList(Type).init(gpa); | 973 | var types = std.array_list.Managed(Type).init(gpa); |
| 974 | defer types.deinit(); | 974 | defer types.deinit(); |
| 975 | 975 | ||
| 976 | var constituents = std.ArrayList(Id).init(gpa); | 976 | var constituents = std.array_list.Managed(Id).init(gpa); |
| 977 | defer constituents.deinit(); | 977 | defer constituents.deinit(); |
| 978 | 978 | ||
| 979 | var it = struct_type.iterateRuntimeOrder(ip); | 979 | var it = struct_type.iterateRuntimeOrder(ip); |
| ... | @@ -1519,13 +1519,13 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { | ... | @@ -1519,13 +1519,13 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { |
| 1519 | return try cg.resolveType(.fromInterned(struct_type.backingIntTypeUnordered(ip)), .direct); | 1519 | return try cg.resolveType(.fromInterned(struct_type.backingIntTypeUnordered(ip)), .direct); |
| 1520 | } | 1520 | } |
| 1521 | 1521 | ||
| 1522 | var member_types = std.ArrayList(Id).init(gpa); | 1522 | var member_types = std.array_list.Managed(Id).init(gpa); |
| 1523 | defer member_types.deinit(); | 1523 | defer member_types.deinit(); |
| 1524 | 1524 | ||
| 1525 | var member_names = std.ArrayList([]const u8).init(gpa); | 1525 | var member_names = std.array_list.Managed([]const u8).init(gpa); |
| 1526 | defer member_names.deinit(); | 1526 | defer member_names.deinit(); |
| 1527 | 1527 | ||
| 1528 | var member_offsets = std.ArrayList(u32).init(gpa); | 1528 | var member_offsets = std.array_list.Managed(u32).init(gpa); |
| 1529 | defer member_offsets.deinit(); | 1529 | defer member_offsets.deinit(); |
| 1530 | 1530 | ||
| 1531 | var it = struct_type.iterateRuntimeOrder(ip); | 1531 | var it = struct_type.iterateRuntimeOrder(ip); |
src/codegen/spirv/Module.zig+2-2| ... | @@ -281,7 +281,7 @@ pub fn addEntryPointDeps( | ... | @@ -281,7 +281,7 @@ pub fn addEntryPointDeps( |
| 281 | module: *Module, | 281 | module: *Module, |
| 282 | decl_index: Decl.Index, | 282 | decl_index: Decl.Index, |
| 283 | seen: *std.DynamicBitSetUnmanaged, | 283 | seen: *std.DynamicBitSetUnmanaged, |
| 284 | interface: *std.ArrayList(Id), | 284 | interface: *std.array_list.Managed(Id), |
| 285 | ) !void { | 285 | ) !void { |
| 286 | const decl = module.declPtr(decl_index); | 286 | const decl = module.declPtr(decl_index); |
| 287 | const deps = module.decl_deps.items[decl.begin_dep..decl.end_dep]; | 287 | const deps = module.decl_deps.items[decl.begin_dep..decl.end_dep]; |
| ... | @@ -307,7 +307,7 @@ fn entryPoints(module: *Module) !Section { | ... | @@ -307,7 +307,7 @@ fn entryPoints(module: *Module) !Section { |
| 307 | var entry_points = Section{}; | 307 | var entry_points = Section{}; |
| 308 | errdefer entry_points.deinit(module.gpa); | 308 | errdefer entry_points.deinit(module.gpa); |
| 309 | 309 | ||
| 310 | var interface = std.ArrayList(Id).init(module.gpa); | 310 | var interface = std.array_list.Managed(Id).init(module.gpa); |
| 311 | defer interface.deinit(); | 311 | defer interface.deinit(); |
| 312 | 312 | ||
| 313 | var seen = try std.DynamicBitSetUnmanaged.initEmpty(module.gpa, module.decls.items.len); | 313 | 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 { | ... | @@ -46,9 +46,9 @@ pub fn run(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 46 | var check_flag = false; | 46 | var check_flag = false; |
| 47 | var check_ast_flag = false; | 47 | var check_ast_flag = false; |
| 48 | var force_zon = false; | 48 | 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); |
| 50 | defer input_files.deinit(); | 50 | 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); |
| 52 | defer excluded_files.deinit(); | 52 | defer excluded_files.deinit(); |
| 53 | 53 | ||
| 54 | { | 54 | { |
src/libs/freebsd.zig+5-5| ... | @@ -76,7 +76,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -76,7 +76,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 76 | 76 | ||
| 77 | switch (crt_file) { | 77 | switch (crt_file) { |
| 78 | .scrt1_o => { | 78 | .scrt1_o => { |
| 79 | var cflags = std.ArrayList([]const u8).init(arena); | 79 | var cflags = std.array_list.Managed([]const u8).init(arena); |
| 80 | try cflags.appendSlice(&.{ | 80 | try cflags.appendSlice(&.{ |
| 81 | "-O2", | 81 | "-O2", |
| 82 | "-fno-common", | 82 | "-fno-common", |
| ... | @@ -89,7 +89,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -89,7 +89,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 89 | try cflags.append("-mlongcall"); | 89 | try cflags.append("-mlongcall"); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | var acflags = std.ArrayList([]const u8).init(arena); | 92 | var acflags = std.array_list.Managed([]const u8).init(arena); |
| 93 | try acflags.appendSlice(&.{ | 93 | try acflags.appendSlice(&.{ |
| 94 | "-DLOCORE", | 94 | "-DLOCORE", |
| 95 | // See `Compilation.addCCArgs`. | 95 | // See `Compilation.addCCArgs`. |
| ... | @@ -510,7 +510,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -510,7 +510,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 510 | }; | 510 | }; |
| 511 | 511 | ||
| 512 | { | 512 | { |
| 513 | var map_contents = std.ArrayList(u8).init(arena); | 513 | var map_contents = std.array_list.Managed(u8).init(arena); |
| 514 | for (metadata.all_versions[0 .. target_ver_index + 1]) |ver| { | 514 | for (metadata.all_versions[0 .. target_ver_index + 1]) |ver| { |
| 515 | try map_contents.writer().print("FBSD_{d}.{d} {{ }};\n", .{ ver.major, ver.minor }); | 515 | try map_contents.writer().print("FBSD_{d}.{d} {{ }};\n", .{ ver.major, ver.minor }); |
| 516 | } | 516 | } |
| ... | @@ -518,7 +518,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -518,7 +518,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 518 | map_contents.deinit(); | 518 | map_contents.deinit(); |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | var stubs_asm = std.ArrayList(u8).init(gpa); | 521 | var stubs_asm = std.array_list.Managed(u8).init(gpa); |
| 522 | defer stubs_asm.deinit(); | 522 | defer stubs_asm.deinit(); |
| 523 | 523 | ||
| 524 | for (libs, 0..) |lib, lib_i| { | 524 | for (libs, 0..) |lib, lib_i| { |
| ... | @@ -529,7 +529,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -529,7 +529,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 529 | try stubs_writer.writeAll(".text\n"); | 529 | try stubs_writer.writeAll(".text\n"); |
| 530 | 530 | ||
| 531 | var sym_i: usize = 0; | 531 | 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); |
| 533 | var opt_symbol_name: ?[]const u8 = null; | 533 | var opt_symbol_name: ?[]const u8 = null; |
| 534 | var versions = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len); | 534 | var versions = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len); |
| 535 | var weak_linkages = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len); | 535 | 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 | ... | @@ -186,7 +186,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 186 | switch (crt_file) { | 186 | switch (crt_file) { |
| 187 | .scrt1_o => { | 187 | .scrt1_o => { |
| 188 | const start_o: Compilation.CSourceFile = blk: { | 188 | 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); |
| 190 | try add_include_dirs(comp, arena, &args); | 190 | try add_include_dirs(comp, arena, &args); |
| 191 | try args.appendSlice(&[_][]const u8{ | 191 | try args.appendSlice(&[_][]const u8{ |
| 192 | "-D_LIBC_REENTRANT", | 192 | "-D_LIBC_REENTRANT", |
| ... | @@ -210,7 +210,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -210,7 +210,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 210 | }; | 210 | }; |
| 211 | }; | 211 | }; |
| 212 | const abi_note_o: Compilation.CSourceFile = blk: { | 212 | 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); |
| 214 | try args.appendSlice(&[_][]const u8{ | 214 | try args.appendSlice(&[_][]const u8{ |
| 215 | "-I", | 215 | "-I", |
| 216 | try lib_path(comp, arena, lib_libc_glibc ++ "csu"), | 216 | 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 | ... | @@ -306,7 +306,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 306 | for (deps) |dep| { | 306 | for (deps) |dep| { |
| 307 | if (!dep.include) continue; | 307 | if (!dep.include) continue; |
| 308 | 308 | ||
| 309 | var args = std.ArrayList([]const u8).init(arena); | 309 | var args = std.array_list.Managed([]const u8).init(arena); |
| 310 | try args.appendSlice(&[_][]const u8{ | 310 | try args.appendSlice(&[_][]const u8{ |
| 311 | "-std=gnu11", | 311 | "-std=gnu11", |
| 312 | "-fgnu89-inline", | 312 | "-fgnu89-inline", |
| ... | @@ -364,7 +364,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ | ... | @@ -364,7 +364,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ |
| 364 | 364 | ||
| 365 | const s = path.sep_str; | 365 | const s = path.sep_str; |
| 366 | 366 | ||
| 367 | var result = std.ArrayList(u8).init(arena); | 367 | var result = std.array_list.Managed(u8).init(arena); |
| 368 | try result.appendSlice(comp.dirs.zig_lib.path orelse "."); | 368 | try result.appendSlice(comp.dirs.zig_lib.path orelse "."); |
| 369 | try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s); | 369 | try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s); |
| 370 | if (is_sparc) { | 370 | if (is_sparc) { |
| ... | @@ -408,7 +408,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ | ... | @@ -408,7 +408,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ |
| 408 | return result.items; | 408 | return result.items; |
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void { | 411 | fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.array_list.Managed([]const u8)) error{OutOfMemory}!void { |
| 412 | const target = comp.getTarget(); | 412 | const target = comp.getTarget(); |
| 413 | const opt_nptl: ?[]const u8 = if (target.os.tag == .linux) "nptl" else "htl"; | 413 | const opt_nptl: ?[]const u8 = if (target.os.tag == .linux) "nptl" else "htl"; |
| 414 | 414 | ||
| ... | @@ -484,7 +484,7 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([ | ... | @@ -484,7 +484,7 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([ |
| 484 | 484 | ||
| 485 | fn add_include_dirs_arch( | 485 | fn add_include_dirs_arch( |
| 486 | arena: Allocator, | 486 | arena: Allocator, |
| 487 | args: *std.ArrayList([]const u8), | 487 | args: *std.array_list.Managed([]const u8), |
| 488 | target: *const std.Target, | 488 | target: *const std.Target, |
| 489 | opt_nptl: ?[]const u8, | 489 | opt_nptl: ?[]const u8, |
| 490 | dir: []const u8, | 490 | dir: []const u8, |
| ... | @@ -749,7 +749,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -749,7 +749,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 749 | }; | 749 | }; |
| 750 | 750 | ||
| 751 | { | 751 | { |
| 752 | var map_contents = std.ArrayList(u8).init(arena); | 752 | var map_contents = std.array_list.Managed(u8).init(arena); |
| 753 | for (metadata.all_versions[0 .. target_ver_index + 1]) |ver| { | 753 | for (metadata.all_versions[0 .. target_ver_index + 1]) |ver| { |
| 754 | if (ver.patch == 0) { | 754 | if (ver.patch == 0) { |
| 755 | try map_contents.writer().print("GLIBC_{d}.{d} {{ }};\n", .{ ver.major, ver.minor }); | 755 | 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 | ... | @@ -761,7 +761,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 761 | map_contents.deinit(); // The most recent allocation of an arena can be freed :) | 761 | map_contents.deinit(); // The most recent allocation of an arena can be freed :) |
| 762 | } | 762 | } |
| 763 | 763 | ||
| 764 | var stubs_asm = std.ArrayList(u8).init(gpa); | 764 | var stubs_asm = std.array_list.Managed(u8).init(gpa); |
| 765 | defer stubs_asm.deinit(); | 765 | defer stubs_asm.deinit(); |
| 766 | 766 | ||
| 767 | for (libs, 0..) |lib, lib_i| { | 767 | for (libs, 0..) |lib, lib_i| { |
| ... | @@ -773,7 +773,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -773,7 +773,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 773 | try stubs_asm.appendSlice(".text\n"); | 773 | try stubs_asm.appendSlice(".text\n"); |
| 774 | 774 | ||
| 775 | var sym_i: usize = 0; | 775 | 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); |
| 777 | var opt_symbol_name: ?[]const u8 = null; | 777 | var opt_symbol_name: ?[]const u8 = null; |
| 778 | var versions_buffer: [32]u8 = undefined; | 778 | var versions_buffer: [32]u8 = undefined; |
| 779 | var versions_len: usize = undefined; | 779 | 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! | ... | @@ -190,7 +190,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 190 | else | 190 | else |
| 191 | &libcxx_base_files; | 191 | &libcxx_base_files; |
| 192 | 192 | ||
| 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); |
| 194 | 194 | ||
| 195 | for (libcxx_files) |cxx_src| { | 195 | for (libcxx_files) |cxx_src| { |
| 196 | // These don't compile on WASI due to e.g. `fchmod` usage. | 196 | // 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! | ... | @@ -201,7 +201,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 201 | if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos) | 201 | if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos) |
| 202 | continue; | 202 | continue; |
| 203 | 203 | ||
| 204 | var cflags = std.ArrayList([]const u8).init(arena); | 204 | var cflags = std.array_list.Managed([]const u8).init(arena); |
| 205 | 205 | ||
| 206 | try addCxxArgs(comp, arena, &cflags); | 206 | try addCxxArgs(comp, arena, &cflags); |
| 207 | 207 | ||
| ... | @@ -233,7 +233,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! | ... | @@ -233,7 +233,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 233 | // These depend on only the zig lib directory file path, which is | 233 | // These depend on only the zig lib directory file path, which is |
| 234 | // purposefully either in the cache or not in the cache. The decision | 234 | // purposefully either in the cache or not in the cache. The decision |
| 235 | // should not be overridden here. | 235 | // 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); |
| 237 | 237 | ||
| 238 | try cache_exempt_flags.append("-I"); | 238 | try cache_exempt_flags.append("-I"); |
| 239 | try cache_exempt_flags.append(cxx_include_path); | 239 | try cache_exempt_flags.append(cxx_include_path); |
| ... | @@ -385,7 +385,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -385,7 +385,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 385 | return error.AlreadyReported; | 385 | return error.AlreadyReported; |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 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); |
| 389 | 389 | ||
| 390 | for (libcxxabi_files) |cxxabi_src| { | 390 | for (libcxxabi_files) |cxxabi_src| { |
| 391 | if (!comp.config.any_non_single_threaded and std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp")) | 391 | 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 | ... | @@ -394,7 +394,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 394 | (std.mem.eql(u8, cxxabi_src, "src/cxa_exception.cpp") or std.mem.eql(u8, cxxabi_src, "src/cxa_personality.cpp"))) | 394 | (std.mem.eql(u8, cxxabi_src, "src/cxa_exception.cpp") or std.mem.eql(u8, cxxabi_src, "src/cxa_personality.cpp"))) |
| 395 | continue; | 395 | continue; |
| 396 | 396 | ||
| 397 | var cflags = std.ArrayList([]const u8).init(arena); | 397 | var cflags = std.array_list.Managed([]const u8).init(arena); |
| 398 | 398 | ||
| 399 | try addCxxArgs(comp, arena, &cflags); | 399 | try addCxxArgs(comp, arena, &cflags); |
| 400 | 400 | ||
| ... | @@ -425,7 +425,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -425,7 +425,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 425 | // These depend on only the zig lib directory file path, which is | 425 | // These depend on only the zig lib directory file path, which is |
| 426 | // purposefully either in the cache or not in the cache. The decision | 426 | // purposefully either in the cache or not in the cache. The decision |
| 427 | // should not be overridden here. | 427 | // 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); |
| 429 | 429 | ||
| 430 | try cache_exempt_flags.append("-I"); | 430 | try cache_exempt_flags.append("-I"); |
| 431 | try cache_exempt_flags.append(cxxabi_include_path); | 431 | try cache_exempt_flags.append(cxxabi_include_path); |
| ... | @@ -497,7 +497,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -497,7 +497,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 497 | pub fn addCxxArgs( | 497 | pub fn addCxxArgs( |
| 498 | comp: *const Compilation, | 498 | comp: *const Compilation, |
| 499 | arena: std.mem.Allocator, | 499 | arena: std.mem.Allocator, |
| 500 | cflags: *std.ArrayList([]const u8), | 500 | cflags: *std.array_list.Managed([]const u8), |
| 501 | ) error{OutOfMemory}!void { | 501 | ) error{OutOfMemory}!void { |
| 502 | const target = comp.getTarget(); | 502 | const target = comp.getTarget(); |
| 503 | const optimize_mode = comp.compilerRtOptMode(); | 503 | 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 | ... | @@ -113,12 +113,12 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 113 | return error.AlreadyReported; | 113 | return error.AlreadyReported; |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | var c_source_files = std.ArrayList(Compilation.CSourceFile).init(arena); | 116 | var c_source_files = std.array_list.Managed(Compilation.CSourceFile).init(arena); |
| 117 | try c_source_files.ensureUnusedCapacity(tsan_sources.len); | 117 | try c_source_files.ensureUnusedCapacity(tsan_sources.len); |
| 118 | 118 | ||
| 119 | const tsan_include_path = try comp.dirs.zig_lib.join(arena, &.{"libtsan"}); | 119 | const tsan_include_path = try comp.dirs.zig_lib.join(arena, &.{"libtsan"}); |
| 120 | for (tsan_sources) |tsan_src| { | 120 | 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); |
| 122 | 122 | ||
| 123 | try cflags.append("-I"); | 123 | try cflags.append("-I"); |
| 124 | try cflags.append(tsan_include_path); | 124 | try cflags.append(tsan_include_path); |
| ... | @@ -139,7 +139,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -139,7 +139,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 139 | }; | 139 | }; |
| 140 | try c_source_files.ensureUnusedCapacity(platform_tsan_sources.len); | 140 | try c_source_files.ensureUnusedCapacity(platform_tsan_sources.len); |
| 141 | for (platform_tsan_sources) |tsan_src| { | 141 | 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); |
| 143 | 143 | ||
| 144 | try cflags.append("-I"); | 144 | try cflags.append("-I"); |
| 145 | try cflags.append(tsan_include_path); | 145 | try cflags.append(tsan_include_path); |
| ... | @@ -163,7 +163,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -163,7 +163,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 163 | .x86_64 => "tsan_rtl_amd64.S", | 163 | .x86_64 => "tsan_rtl_amd64.S", |
| 164 | else => return error.TSANUnsupportedCPUArchitecture, | 164 | else => return error.TSANUnsupportedCPUArchitecture, |
| 165 | }; | 165 | }; |
| 166 | var cflags = std.ArrayList([]const u8).init(arena); | 166 | var cflags = std.array_list.Managed([]const u8).init(arena); |
| 167 | 167 | ||
| 168 | try cflags.append("-I"); | 168 | try cflags.append("-I"); |
| 169 | try cflags.append(tsan_include_path); | 169 | try cflags.append(tsan_include_path); |
| ... | @@ -182,7 +182,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -182,7 +182,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 182 | "libtsan", "sanitizer_common", | 182 | "libtsan", "sanitizer_common", |
| 183 | }); | 183 | }); |
| 184 | for (sanitizer_common_sources) |common_src| { | 184 | 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); |
| 186 | 186 | ||
| 187 | try cflags.append("-I"); | 187 | try cflags.append("-I"); |
| 188 | try cflags.append(sanitizer_common_include_path); | 188 | try cflags.append(sanitizer_common_include_path); |
| ... | @@ -206,7 +206,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -206,7 +206,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 206 | &sanitizer_nolibc_sources; | 206 | &sanitizer_nolibc_sources; |
| 207 | try c_source_files.ensureUnusedCapacity(to_c_or_not_to_c_sources.len); | 207 | try c_source_files.ensureUnusedCapacity(to_c_or_not_to_c_sources.len); |
| 208 | for (to_c_or_not_to_c_sources) |c_src| { | 208 | 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); |
| 210 | 210 | ||
| 211 | try cflags.append("-I"); | 211 | try cflags.append("-I"); |
| 212 | try cflags.append(sanitizer_common_include_path); | 212 | try cflags.append(sanitizer_common_include_path); |
| ... | @@ -226,7 +226,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -226,7 +226,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 226 | 226 | ||
| 227 | try c_source_files.ensureUnusedCapacity(sanitizer_symbolizer_sources.len); | 227 | try c_source_files.ensureUnusedCapacity(sanitizer_symbolizer_sources.len); |
| 228 | for (sanitizer_symbolizer_sources) |c_src| { | 228 | 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); |
| 230 | 230 | ||
| 231 | try cflags.append("-I"); | 231 | try cflags.append("-I"); |
| 232 | try cflags.append(tsan_include_path); | 232 | try cflags.append(tsan_include_path); |
| ... | @@ -246,7 +246,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -246,7 +246,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 246 | 246 | ||
| 247 | try c_source_files.ensureUnusedCapacity(interception_sources.len); | 247 | try c_source_files.ensureUnusedCapacity(interception_sources.len); |
| 248 | for (interception_sources) |c_src| { | 248 | 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); |
| 250 | 250 | ||
| 251 | try cflags.append("-I"); | 251 | try cflags.append("-I"); |
| 252 | try cflags.append(interception_include_path); | 252 | try cflags.append(interception_include_path); |
| ... | @@ -323,7 +323,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -323,7 +323,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 323 | comp.tsan_lib = crt_file; | 323 | comp.tsan_lib = crt_file; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | fn addCcArgs(target: *const std.Target, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void { | 326 | fn addCcArgs(target: *const std.Target, args: *std.array_list.Managed([]const u8)) error{OutOfMemory}!void { |
| 327 | try args.appendSlice(&[_][]const u8{ | 327 | try args.appendSlice(&[_][]const u8{ |
| 328 | "-nostdinc++", | 328 | "-nostdinc++", |
| 329 | "-fvisibility=hidden", | 329 | "-fvisibility=hidden", |
src/libs/libunwind.zig+1-1| ... | @@ -87,7 +87,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -87,7 +87,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 87 | const root_name = "unwind"; | 87 | const root_name = "unwind"; |
| 88 | var c_source_files: [unwind_src_list.len]Compilation.CSourceFile = undefined; | 88 | var c_source_files: [unwind_src_list.len]Compilation.CSourceFile = undefined; |
| 89 | for (unwind_src_list, 0..) |unwind_src, i| { | 89 | 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); |
| 91 | 91 | ||
| 92 | switch (Compilation.classifyFileExt(unwind_src)) { | 92 | switch (Compilation.classifyFileExt(unwind_src)) { |
| 93 | .c => { | 93 | .c => { |
src/libs/mingw.zig+8-8| ... | @@ -33,7 +33,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -33,7 +33,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 33 | 33 | ||
| 34 | switch (crt_file) { | 34 | switch (crt_file) { |
| 35 | .crt2_o => { | 35 | .crt2_o => { |
| 36 | var args = std.ArrayList([]const u8).init(arena); | 36 | var args = std.array_list.Managed([]const u8).init(arena); |
| 37 | try addCrtCcArgs(comp, arena, &args); | 37 | try addCrtCcArgs(comp, arena, &args); |
| 38 | if (comp.mingw_unicode_entry_point) { | 38 | if (comp.mingw_unicode_entry_point) { |
| 39 | try args.appendSlice(&.{ "-DUNICODE", "-D_UNICODE" }); | 39 | try args.appendSlice(&.{ "-DUNICODE", "-D_UNICODE" }); |
| ... | @@ -53,7 +53,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -53,7 +53,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 53 | }, | 53 | }, |
| 54 | 54 | ||
| 55 | .dllcrt2_o => { | 55 | .dllcrt2_o => { |
| 56 | var args = std.ArrayList([]const u8).init(arena); | 56 | var args = std.array_list.Managed([]const u8).init(arena); |
| 57 | try addCrtCcArgs(comp, arena, &args); | 57 | try addCrtCcArgs(comp, arena, &args); |
| 58 | var files = [_]Compilation.CSourceFile{ | 58 | var files = [_]Compilation.CSourceFile{ |
| 59 | .{ | 59 | .{ |
| ... | @@ -70,10 +70,10 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -70,10 +70,10 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 70 | }, | 70 | }, |
| 71 | 71 | ||
| 72 | .libmingw32_lib => { | 72 | .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); |
| 74 | 74 | ||
| 75 | { | 75 | { |
| 76 | var crt_args = std.ArrayList([]const u8).init(arena); | 76 | var crt_args = std.array_list.Managed([]const u8).init(arena); |
| 77 | try addCrtCcArgs(comp, arena, &crt_args); | 77 | try addCrtCcArgs(comp, arena, &crt_args); |
| 78 | 78 | ||
| 79 | for (mingw32_generic_src) |dep| { | 79 | for (mingw32_generic_src) |dep| { |
| ... | @@ -150,7 +150,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -150,7 +150,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | { | 152 | { |
| 153 | var winpthreads_args = std.ArrayList([]const u8).init(arena); | 153 | var winpthreads_args = std.array_list.Managed([]const u8).init(arena); |
| 154 | try addCcArgs(comp, arena, &winpthreads_args); | 154 | try addCcArgs(comp, arena, &winpthreads_args); |
| 155 | try winpthreads_args.appendSlice(&[_][]const u8{ | 155 | try winpthreads_args.appendSlice(&[_][]const u8{ |
| 156 | "-DIN_WINPTHREAD", | 156 | "-DIN_WINPTHREAD", |
| ... | @@ -186,7 +186,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -186,7 +186,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 186 | fn addCcArgs( | 186 | fn addCcArgs( |
| 187 | comp: *Compilation, | 187 | comp: *Compilation, |
| 188 | arena: Allocator, | 188 | arena: Allocator, |
| 189 | args: *std.ArrayList([]const u8), | 189 | args: *std.array_list.Managed([]const u8), |
| 190 | ) error{OutOfMemory}!void { | 190 | ) error{OutOfMemory}!void { |
| 191 | try args.appendSlice(&[_][]const u8{ | 191 | try args.appendSlice(&[_][]const u8{ |
| 192 | "-std=gnu11", | 192 | "-std=gnu11", |
| ... | @@ -200,7 +200,7 @@ fn addCcArgs( | ... | @@ -200,7 +200,7 @@ fn addCcArgs( |
| 200 | fn addCrtCcArgs( | 200 | fn addCrtCcArgs( |
| 201 | comp: *Compilation, | 201 | comp: *Compilation, |
| 202 | arena: Allocator, | 202 | arena: Allocator, |
| 203 | args: *std.ArrayList([]const u8), | 203 | args: *std.array_list.Managed([]const u8), |
| 204 | ) error{OutOfMemory}!void { | 204 | ) error{OutOfMemory}!void { |
| 205 | try addCcArgs(comp, arena, args); | 205 | try addCcArgs(comp, arena, args); |
| 206 | 206 | ||
| ... | @@ -401,7 +401,7 @@ fn findDef( | ... | @@ -401,7 +401,7 @@ fn findDef( |
| 401 | else => unreachable, | 401 | else => unreachable, |
| 402 | }; | 402 | }; |
| 403 | 403 | ||
| 404 | var override_path = std.ArrayList(u8).init(allocator); | 404 | var override_path = std.array_list.Managed(u8).init(allocator); |
| 405 | defer override_path.deinit(); | 405 | defer override_path.deinit(); |
| 406 | 406 | ||
| 407 | const s = path.sep_str; | 407 | 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 | ... | @@ -29,7 +29,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 29 | 29 | ||
| 30 | switch (in_crt_file) { | 30 | switch (in_crt_file) { |
| 31 | .crt1_o => { | 31 | .crt1_o => { |
| 32 | var args = std.ArrayList([]const u8).init(arena); | 32 | var args = std.array_list.Managed([]const u8).init(arena); |
| 33 | try addCcArgs(comp, arena, &args, false); | 33 | try addCcArgs(comp, arena, &args, false); |
| 34 | try args.append("-DCRT"); | 34 | try args.append("-DCRT"); |
| 35 | var files = [_]Compilation.CSourceFile{ | 35 | var files = [_]Compilation.CSourceFile{ |
| ... | @@ -49,7 +49,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -49,7 +49,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 49 | }); | 49 | }); |
| 50 | }, | 50 | }, |
| 51 | .rcrt1_o => { | 51 | .rcrt1_o => { |
| 52 | var args = std.ArrayList([]const u8).init(arena); | 52 | var args = std.array_list.Managed([]const u8).init(arena); |
| 53 | try addCcArgs(comp, arena, &args, false); | 53 | try addCcArgs(comp, arena, &args, false); |
| 54 | try args.append("-DCRT"); | 54 | try args.append("-DCRT"); |
| 55 | var files = [_]Compilation.CSourceFile{ | 55 | var files = [_]Compilation.CSourceFile{ |
| ... | @@ -70,7 +70,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -70,7 +70,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 70 | }); | 70 | }); |
| 71 | }, | 71 | }, |
| 72 | .scrt1_o => { | 72 | .scrt1_o => { |
| 73 | var args = std.ArrayList([]const u8).init(arena); | 73 | var args = std.array_list.Managed([]const u8).init(arena); |
| 74 | try addCcArgs(comp, arena, &args, false); | 74 | try addCcArgs(comp, arena, &args, false); |
| 75 | try args.append("-DCRT"); | 75 | try args.append("-DCRT"); |
| 76 | var files = [_]Compilation.CSourceFile{ | 76 | var files = [_]Compilation.CSourceFile{ |
| ... | @@ -112,10 +112,10 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -112,10 +112,10 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 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); |
| 116 | defer c_source_files.deinit(); | 116 | defer c_source_files.deinit(); |
| 117 | 117 | ||
| 118 | var override_path = std.ArrayList(u8).init(comp.gpa); | 118 | var override_path = std.array_list.Managed(u8).init(comp.gpa); |
| 119 | defer override_path.deinit(); | 119 | defer override_path.deinit(); |
| 120 | 120 | ||
| 121 | const s = path.sep_str; | 121 | const s = path.sep_str; |
| ... | @@ -161,7 +161,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -161,7 +161,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 161 | continue; | 161 | continue; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | var args = std.ArrayList([]const u8).init(arena); | 164 | var args = std.array_list.Managed([]const u8).init(arena); |
| 165 | try addCcArgs(comp, arena, &args, ext == .o3); | 165 | try addCcArgs(comp, arena, &args, ext == .o3); |
| 166 | const c_source_file = try c_source_files.addOne(); | 166 | const c_source_file = try c_source_files.addOne(); |
| 167 | c_source_file.* = .{ | 167 | c_source_file.* = .{ |
| ... | @@ -390,7 +390,7 @@ fn addSrcFile(arena: Allocator, source_table: *std.StringArrayHashMap(Ext), file | ... | @@ -390,7 +390,7 @@ fn addSrcFile(arena: Allocator, source_table: *std.StringArrayHashMap(Ext), file |
| 390 | fn addCcArgs( | 390 | fn addCcArgs( |
| 391 | comp: *Compilation, | 391 | comp: *Compilation, |
| 392 | arena: Allocator, | 392 | arena: Allocator, |
| 393 | args: *std.ArrayList([]const u8), | 393 | args: *std.array_list.Managed([]const u8), |
| 394 | want_O3: bool, | 394 | want_O3: bool, |
| 395 | ) error{OutOfMemory}!void { | 395 | ) error{OutOfMemory}!void { |
| 396 | const target = comp.getTarget(); | 396 | 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 | ... | @@ -69,13 +69,13 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 69 | 69 | ||
| 70 | switch (crt_file) { | 70 | switch (crt_file) { |
| 71 | .scrt0_o => { | 71 | .scrt0_o => { |
| 72 | var cflags = std.ArrayList([]const u8).init(arena); | 72 | var cflags = std.array_list.Managed([]const u8).init(arena); |
| 73 | try cflags.appendSlice(&.{ | 73 | try cflags.appendSlice(&.{ |
| 74 | "-DHAVE_INITFINI_ARRAY", | 74 | "-DHAVE_INITFINI_ARRAY", |
| 75 | "-w", // Disable all warnings. | 75 | "-w", // Disable all warnings. |
| 76 | }); | 76 | }); |
| 77 | 77 | ||
| 78 | var acflags = std.ArrayList([]const u8).init(arena); | 78 | var acflags = std.array_list.Managed([]const u8).init(arena); |
| 79 | try acflags.appendSlice(&.{ | 79 | try acflags.appendSlice(&.{ |
| 80 | // See `Compilation.addCCArgs`. | 80 | // See `Compilation.addCCArgs`. |
| 81 | try std.fmt.allocPrint(arena, "-D__NetBSD_Version__={d}", .{(target_version.major * 100_000_000) + (target_version.minor * 1_000_000)}), | 81 | 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 | ... | @@ -454,7 +454,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 454 | break :blk latest_index; | 454 | break :blk latest_index; |
| 455 | }; | 455 | }; |
| 456 | 456 | ||
| 457 | var stubs_asm = std.ArrayList(u8).init(gpa); | 457 | var stubs_asm = std.array_list.Managed(u8).init(gpa); |
| 458 | defer stubs_asm.deinit(); | 458 | defer stubs_asm.deinit(); |
| 459 | 459 | ||
| 460 | for (libs, 0..) |lib, lib_i| { | 460 | for (libs, 0..) |lib, lib_i| { |
| ... | @@ -465,7 +465,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -465,7 +465,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 465 | try stubs_writer.writeAll(".text\n"); | 465 | try stubs_writer.writeAll(".text\n"); |
| 466 | 466 | ||
| 467 | var sym_i: usize = 0; | 467 | 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); |
| 469 | var opt_symbol_name: ?[]const u8 = null; | 469 | var opt_symbol_name: ?[]const u8 = null; |
| 470 | 470 | ||
| 471 | var inc_fbs = std.io.fixedBufferStream(metadata.inclusions); | 471 | 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 | ... | @@ -41,7 +41,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 41 | 41 | ||
| 42 | switch (crt_file) { | 42 | switch (crt_file) { |
| 43 | .crt1_reactor_o => { | 43 | .crt1_reactor_o => { |
| 44 | var args = std.ArrayList([]const u8).init(arena); | 44 | var args = std.array_list.Managed([]const u8).init(arena); |
| 45 | try addCCArgs(comp, arena, &args, .{}); | 45 | try addCCArgs(comp, arena, &args, .{}); |
| 46 | try addLibcBottomHalfIncludes(comp, arena, &args); | 46 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 47 | var files = [_]Compilation.CSourceFile{ | 47 | var files = [_]Compilation.CSourceFile{ |
| ... | @@ -56,7 +56,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -56,7 +56,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 56 | return comp.build_crt_file("crt1-reactor", .Obj, .@"wasi crt1-reactor.o", prog_node, &files, .{}); | 56 | return comp.build_crt_file("crt1-reactor", .Obj, .@"wasi crt1-reactor.o", prog_node, &files, .{}); |
| 57 | }, | 57 | }, |
| 58 | .crt1_command_o => { | 58 | .crt1_command_o => { |
| 59 | var args = std.ArrayList([]const u8).init(arena); | 59 | var args = std.array_list.Managed([]const u8).init(arena); |
| 60 | try addCCArgs(comp, arena, &args, .{}); | 60 | try addCCArgs(comp, arena, &args, .{}); |
| 61 | try addLibcBottomHalfIncludes(comp, arena, &args); | 61 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 62 | var files = [_]Compilation.CSourceFile{ | 62 | var files = [_]Compilation.CSourceFile{ |
| ... | @@ -71,11 +71,11 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -71,11 +71,11 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 71 | return comp.build_crt_file("crt1-command", .Obj, .@"wasi crt1-command.o", prog_node, &files, .{}); | 71 | return comp.build_crt_file("crt1-command", .Obj, .@"wasi crt1-command.o", prog_node, &files, .{}); |
| 72 | }, | 72 | }, |
| 73 | .libc_a => { | 73 | .libc_a => { |
| 74 | var libc_sources = std.ArrayList(Compilation.CSourceFile).init(arena); | 74 | var libc_sources = std.array_list.Managed(Compilation.CSourceFile).init(arena); |
| 75 | 75 | ||
| 76 | { | 76 | { |
| 77 | // Compile emmalloc. | 77 | // Compile emmalloc. |
| 78 | var args = std.ArrayList([]const u8).init(arena); | 78 | var args = std.array_list.Managed([]const u8).init(arena); |
| 79 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true, .no_strict_aliasing = true }); | 79 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true, .no_strict_aliasing = true }); |
| 80 | for (emmalloc_src_files) |file_path| { | 80 | for (emmalloc_src_files) |file_path| { |
| 81 | try libc_sources.append(.{ | 81 | try libc_sources.append(.{ |
| ... | @@ -90,7 +90,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -90,7 +90,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 90 | 90 | ||
| 91 | { | 91 | { |
| 92 | // Compile libc-bottom-half. | 92 | // Compile libc-bottom-half. |
| 93 | var args = std.ArrayList([]const u8).init(arena); | 93 | var args = std.array_list.Managed([]const u8).init(arena); |
| 94 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); | 94 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); |
| 95 | try addLibcBottomHalfIncludes(comp, arena, &args); | 95 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 96 | 96 | ||
| ... | @@ -107,7 +107,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -107,7 +107,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 107 | 107 | ||
| 108 | { | 108 | { |
| 109 | // Compile libc-top-half. | 109 | // Compile libc-top-half. |
| 110 | var args = std.ArrayList([]const u8).init(arena); | 110 | var args = std.array_list.Managed([]const u8).init(arena); |
| 111 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); | 111 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); |
| 112 | try addLibcTopHalfIncludes(comp, arena, &args); | 112 | try addLibcTopHalfIncludes(comp, arena, &args); |
| 113 | 113 | ||
| ... | @@ -124,7 +124,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -124,7 +124,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 124 | 124 | ||
| 125 | { | 125 | { |
| 126 | // Compile libdl. | 126 | // Compile libdl. |
| 127 | var args = std.ArrayList([]const u8).init(arena); | 127 | var args = std.array_list.Managed([]const u8).init(arena); |
| 128 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); | 128 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); |
| 129 | try addLibcBottomHalfIncludes(comp, arena, &args); | 129 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 130 | 130 | ||
| ... | @@ -141,7 +141,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -141,7 +141,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 141 | 141 | ||
| 142 | { | 142 | { |
| 143 | // Compile libwasi-emulated-process-clocks. | 143 | // 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); |
| 145 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); | 145 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); |
| 146 | try args.appendSlice(&.{ | 146 | try args.appendSlice(&.{ |
| 147 | "-I", | 147 | "-I", |
| ... | @@ -167,7 +167,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -167,7 +167,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 167 | 167 | ||
| 168 | { | 168 | { |
| 169 | // Compile libwasi-emulated-getpid. | 169 | // Compile libwasi-emulated-getpid. |
| 170 | var args = std.ArrayList([]const u8).init(arena); | 170 | var args = std.array_list.Managed([]const u8).init(arena); |
| 171 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); | 171 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); |
| 172 | try addLibcBottomHalfIncludes(comp, arena, &args); | 172 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 173 | 173 | ||
| ... | @@ -184,7 +184,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -184,7 +184,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 184 | 184 | ||
| 185 | { | 185 | { |
| 186 | // Compile libwasi-emulated-mman. | 186 | // Compile libwasi-emulated-mman. |
| 187 | var args = std.ArrayList([]const u8).init(arena); | 187 | var args = std.array_list.Managed([]const u8).init(arena); |
| 188 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); | 188 | try addCCArgs(comp, arena, &args, .{ .want_O3 = true }); |
| 189 | try addLibcBottomHalfIncludes(comp, arena, &args); | 189 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 190 | 190 | ||
| ... | @@ -201,7 +201,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre | ... | @@ -201,7 +201,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 201 | 201 | ||
| 202 | { | 202 | { |
| 203 | // Compile libwasi-emulated-signal. | 203 | // 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); |
| 205 | try addCCArgs(comp, arena, &bottom_args, .{ .want_O3 = true }); | 205 | try addCCArgs(comp, arena, &bottom_args, .{ .want_O3 = true }); |
| 206 | 206 | ||
| 207 | for (emulated_signal_bottom_half_src_files) |file_path| { | 207 | 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 | ... | @@ -214,7 +214,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 214 | }); | 214 | }); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | var top_args = std.ArrayList([]const u8).init(arena); | 217 | var top_args = std.array_list.Managed([]const u8).init(arena); |
| 218 | try addCCArgs(comp, arena, &top_args, .{ .want_O3 = true }); | 218 | try addCCArgs(comp, arena, &top_args, .{ .want_O3 = true }); |
| 219 | try addLibcTopHalfIncludes(comp, arena, &top_args); | 219 | try addLibcTopHalfIncludes(comp, arena, &top_args); |
| 220 | try top_args.append("-D_WASI_EMULATED_SIGNAL"); | 220 | try top_args.append("-D_WASI_EMULATED_SIGNAL"); |
| ... | @@ -259,7 +259,7 @@ const CCOptions = struct { | ... | @@ -259,7 +259,7 @@ const CCOptions = struct { |
| 259 | fn addCCArgs( | 259 | fn addCCArgs( |
| 260 | comp: *Compilation, | 260 | comp: *Compilation, |
| 261 | arena: Allocator, | 261 | arena: Allocator, |
| 262 | args: *std.ArrayList([]const u8), | 262 | args: *std.array_list.Managed([]const u8), |
| 263 | options: CCOptions, | 263 | options: CCOptions, |
| 264 | ) error{OutOfMemory}!void { | 264 | ) error{OutOfMemory}!void { |
| 265 | const target = comp.getTarget(); | 265 | const target = comp.getTarget(); |
| ... | @@ -298,7 +298,7 @@ fn addCCArgs( | ... | @@ -298,7 +298,7 @@ fn addCCArgs( |
| 298 | fn addLibcBottomHalfIncludes( | 298 | fn addLibcBottomHalfIncludes( |
| 299 | comp: *Compilation, | 299 | comp: *Compilation, |
| 300 | arena: Allocator, | 300 | arena: Allocator, |
| 301 | args: *std.ArrayList([]const u8), | 301 | args: *std.array_list.Managed([]const u8), |
| 302 | ) error{OutOfMemory}!void { | 302 | ) error{OutOfMemory}!void { |
| 303 | try args.appendSlice(&[_][]const u8{ | 303 | try args.appendSlice(&[_][]const u8{ |
| 304 | "-I", | 304 | "-I", |
| ... | @@ -370,7 +370,7 @@ fn addLibcBottomHalfIncludes( | ... | @@ -370,7 +370,7 @@ fn addLibcBottomHalfIncludes( |
| 370 | fn addLibcTopHalfIncludes( | 370 | fn addLibcTopHalfIncludes( |
| 371 | comp: *Compilation, | 371 | comp: *Compilation, |
| 372 | arena: Allocator, | 372 | arena: Allocator, |
| 373 | args: *std.ArrayList([]const u8), | 373 | args: *std.array_list.Managed([]const u8), |
| 374 | ) error{OutOfMemory}!void { | 374 | ) error{OutOfMemory}!void { |
| 375 | try args.appendSlice(&[_][]const u8{ | 375 | try args.appendSlice(&[_][]const u8{ |
| 376 | "-I", | 376 | "-I", |
src/link.zig+1-1| ... | @@ -166,7 +166,7 @@ pub const Diags = struct { | ... | @@ -166,7 +166,7 @@ pub const Diags = struct { |
| 166 | ) Allocator.Error!void { | 166 | ) Allocator.Error!void { |
| 167 | const gpa = diags.gpa; | 167 | const gpa = diags.gpa; |
| 168 | 168 | ||
| 169 | var context_lines = std.ArrayList([]const u8).init(gpa); | 169 | var context_lines = std.array_list.Managed([]const u8).init(gpa); |
| 170 | defer context_lines.deinit(); | 170 | defer context_lines.deinit(); |
| 171 | 171 | ||
| 172 | var current_err: ?*Lld = null; | 172 | var current_err: ?*Lld = null; |
src/link/C.zig+1-1| ... | @@ -766,7 +766,7 @@ pub fn flushEmitH(zcu: *Zcu) !void { | ... | @@ -766,7 +766,7 @@ pub fn flushEmitH(zcu: *Zcu) !void { |
| 766 | 766 | ||
| 767 | // We collect a list of buffers to write, and write them all at once with pwritev 😎 | 767 | // We collect a list of buffers to write, and write them all at once with pwritev 😎 |
| 768 | const num_buffers = emit_h.decl_table.count() + 1; | 768 | 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); |
| 770 | defer all_buffers.deinit(); | 770 | defer all_buffers.deinit(); |
| 771 | 771 | ||
| 772 | var file_size: u64 = zig_h.len; | 772 | 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 | ... | @@ -771,7 +771,7 @@ fn writeAtom(coff: *Coff, atom_index: Atom.Index, code: []u8, resolve_relocs: bo |
| 771 | // if we are running in hot-code swapping mode or not. | 771 | // if we are running in hot-code swapping mode or not. |
| 772 | // TODO: how crazy would it be to try and apply the actual image base of the loaded | 772 | // TODO: how crazy would it be to try and apply the actual image base of the loaded |
| 773 | // process for the in-file values rather than the Windows defaults? | 773 | // 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); |
| 775 | defer relocs.deinit(); | 775 | defer relocs.deinit(); |
| 776 | 776 | ||
| 777 | if (resolve_relocs) { | 777 | if (resolve_relocs) { |
| ... | @@ -1680,7 +1680,7 @@ fn flushInner(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id) !void { | ... | @@ -1680,7 +1680,7 @@ fn flushInner(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id) !void { |
| 1680 | const section = coff.sections.get(@intFromEnum(sym.section_number) - 1).header; | 1680 | const section = coff.sections.get(@intFromEnum(sym.section_number) - 1).header; |
| 1681 | const file_offset = section.pointer_to_raw_data + sym.value - section.virtual_address; | 1681 | const file_offset = section.pointer_to_raw_data + sym.value - section.virtual_address; |
| 1682 | 1682 | ||
| 1683 | var code = std.ArrayList(u8).init(gpa); | 1683 | var code = std.array_list.Managed(u8).init(gpa); |
| 1684 | defer code.deinit(); | 1684 | defer code.deinit(); |
| 1685 | try code.resize(math.cast(usize, atom.size) orelse return error.Overflow); | 1685 | try code.resize(math.cast(usize, atom.size) orelse return error.Overflow); |
| 1686 | assert(atom.size > 0); | 1686 | assert(atom.size > 0); |
| ... | @@ -1893,7 +1893,7 @@ pub fn updateLineNumber(coff: *Coff, pt: Zcu.PerThread, ti_id: InternPool.Tracke | ... | @@ -1893,7 +1893,7 @@ pub fn updateLineNumber(coff: *Coff, pt: Zcu.PerThread, ti_id: InternPool.Tracke |
| 1893 | fn writeBaseRelocations(coff: *Coff) !void { | 1893 | fn writeBaseRelocations(coff: *Coff) !void { |
| 1894 | const gpa = coff.base.comp.gpa; | 1894 | const gpa = coff.base.comp.gpa; |
| 1895 | 1895 | ||
| 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); |
| 1897 | defer { | 1897 | defer { |
| 1898 | var it = page_table.valueIterator(); | 1898 | var it = page_table.valueIterator(); |
| 1899 | while (it.next()) |inner| { | 1899 | while (it.next()) |inner| { |
| ... | @@ -1915,7 +1915,7 @@ fn writeBaseRelocations(coff: *Coff) !void { | ... | @@ -1915,7 +1915,7 @@ fn writeBaseRelocations(coff: *Coff) !void { |
| 1915 | const page = mem.alignBackward(u32, rva, coff.page_size); | 1915 | const page = mem.alignBackward(u32, rva, coff.page_size); |
| 1916 | const gop = try page_table.getOrPut(page); | 1916 | const gop = try page_table.getOrPut(page); |
| 1917 | if (!gop.found_existing) { | 1917 | 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); |
| 1919 | } | 1919 | } |
| 1920 | try gop.value_ptr.append(.{ | 1920 | try gop.value_ptr.append(.{ |
| 1921 | .offset = @as(u12, @intCast(rva - page)), | 1921 | .offset = @as(u12, @intCast(rva - page)), |
| ... | @@ -1936,7 +1936,7 @@ fn writeBaseRelocations(coff: *Coff) !void { | ... | @@ -1936,7 +1936,7 @@ fn writeBaseRelocations(coff: *Coff) !void { |
| 1936 | const page = mem.alignBackward(u32, rva, coff.page_size); | 1936 | const page = mem.alignBackward(u32, rva, coff.page_size); |
| 1937 | const gop = try page_table.getOrPut(page); | 1937 | const gop = try page_table.getOrPut(page); |
| 1938 | if (!gop.found_existing) { | 1938 | 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); |
| 1940 | } | 1940 | } |
| 1941 | try gop.value_ptr.append(.{ | 1941 | try gop.value_ptr.append(.{ |
| 1942 | .offset = @as(u12, @intCast(rva - page)), | 1942 | .offset = @as(u12, @intCast(rva - page)), |
| ... | @@ -1947,7 +1947,7 @@ fn writeBaseRelocations(coff: *Coff) !void { | ... | @@ -1947,7 +1947,7 @@ fn writeBaseRelocations(coff: *Coff) !void { |
| 1947 | } | 1947 | } |
| 1948 | 1948 | ||
| 1949 | // Sort pages by address. | 1949 | // 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()); |
| 1951 | defer pages.deinit(); | 1951 | defer pages.deinit(); |
| 1952 | { | 1952 | { |
| 1953 | var it = page_table.keyIterator(); | 1953 | var it = page_table.keyIterator(); |
| ... | @@ -1957,7 +1957,7 @@ fn writeBaseRelocations(coff: *Coff) !void { | ... | @@ -1957,7 +1957,7 @@ fn writeBaseRelocations(coff: *Coff) !void { |
| 1957 | } | 1957 | } |
| 1958 | mem.sort(u32, pages.items, {}, std.sort.asc(u32)); | 1958 | mem.sort(u32, pages.items, {}, std.sort.asc(u32)); |
| 1959 | 1959 | ||
| 1960 | var buffer = std.ArrayList(u8).init(gpa); | 1960 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 1961 | defer buffer.deinit(); | 1961 | defer buffer.deinit(); |
| 1962 | 1962 | ||
| 1963 | for (pages.items) |page| { | 1963 | for (pages.items) |page| { |
| ... | @@ -2030,7 +2030,7 @@ fn writeImportTables(coff: *Coff) !void { | ... | @@ -2030,7 +2030,7 @@ fn writeImportTables(coff: *Coff) !void { |
| 2030 | try coff.growSection(coff.idata_section_index.?, needed_size); | 2030 | try coff.growSection(coff.idata_section_index.?, needed_size); |
| 2031 | 2031 | ||
| 2032 | // Do the actual writes | 2032 | // Do the actual writes |
| 2033 | var buffer = std.ArrayList(u8).init(gpa); | 2033 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 2034 | defer buffer.deinit(); | 2034 | defer buffer.deinit(); |
| 2035 | try buffer.ensureTotalCapacityPrecise(needed_size); | 2035 | try buffer.ensureTotalCapacityPrecise(needed_size); |
| 2036 | buffer.resize(needed_size) catch unreachable; | 2036 | buffer.resize(needed_size) catch unreachable; |
| ... | @@ -2153,7 +2153,7 @@ fn writeStrtab(coff: *Coff) !void { | ... | @@ -2153,7 +2153,7 @@ fn writeStrtab(coff: *Coff) !void { |
| 2153 | 2153 | ||
| 2154 | log.debug("writing strtab from 0x{x} to 0x{x}", .{ coff.strtab_offset.?, coff.strtab_offset.? + needed_size }); | 2154 | log.debug("writing strtab from 0x{x} to 0x{x}", .{ coff.strtab_offset.?, coff.strtab_offset.? + needed_size }); |
| 2155 | 2155 | ||
| 2156 | var buffer = std.ArrayList(u8).init(gpa); | 2156 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 2157 | defer buffer.deinit(); | 2157 | defer buffer.deinit(); |
| 2158 | try buffer.ensureTotalCapacityPrecise(needed_size); | 2158 | try buffer.ensureTotalCapacityPrecise(needed_size); |
| 2159 | buffer.appendSliceAssumeCapacity(coff.strtab.buffer.items); | 2159 | buffer.appendSliceAssumeCapacity(coff.strtab.buffer.items); |
| ... | @@ -2179,7 +2179,7 @@ fn writeDataDirectoriesHeaders(coff: *Coff) !void { | ... | @@ -2179,7 +2179,7 @@ fn writeDataDirectoriesHeaders(coff: *Coff) !void { |
| 2179 | fn writeHeader(coff: *Coff) !void { | 2179 | fn writeHeader(coff: *Coff) !void { |
| 2180 | const target = &coff.base.comp.root_mod.resolved_target.result; | 2180 | const target = &coff.base.comp.root_mod.resolved_target.result; |
| 2181 | const gpa = coff.base.comp.gpa; | 2181 | const gpa = coff.base.comp.gpa; |
| 2182 | var buffer = std.ArrayList(u8).init(gpa); | 2182 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 2183 | defer buffer.deinit(); | 2183 | defer buffer.deinit(); |
| 2184 | const writer = buffer.writer(); | 2184 | const writer = buffer.writer(); |
| 2185 | 2185 |
src/link/Elf.zig+17-17| ... | @@ -882,7 +882,7 @@ fn flushInner(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id) !void { | ... | @@ -882,7 +882,7 @@ fn flushInner(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id) !void { |
| 882 | self.rela_plt.clearRetainingCapacity(); | 882 | self.rela_plt.clearRetainingCapacity(); |
| 883 | 883 | ||
| 884 | if (self.zigObjectPtr()) |zo| { | 884 | 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); |
| 886 | defer { | 886 | defer { |
| 887 | for (undefs.values()) |*refs| refs.deinit(); | 887 | for (undefs.values()) |*refs| refs.deinit(); |
| 888 | undefs.deinit(); | 888 | undefs.deinit(); |
| ... | @@ -1326,7 +1326,7 @@ fn scanRelocs(self: *Elf) !void { | ... | @@ -1326,7 +1326,7 @@ fn scanRelocs(self: *Elf) !void { |
| 1326 | const gpa = self.base.comp.gpa; | 1326 | const gpa = self.base.comp.gpa; |
| 1327 | const shared_objects = self.shared_objects.values(); | 1327 | const shared_objects = self.shared_objects.values(); |
| 1328 | 1328 | ||
| 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); |
| 1330 | defer { | 1330 | defer { |
| 1331 | for (undefs.values()) |*refs| refs.deinit(); | 1331 | for (undefs.values()) |*refs| refs.deinit(); |
| 1332 | undefs.deinit(); | 1332 | undefs.deinit(); |
| ... | @@ -1849,7 +1849,7 @@ pub fn updateMergeSectionSizes(self: *Elf) !void { | ... | @@ -1849,7 +1849,7 @@ pub fn updateMergeSectionSizes(self: *Elf) !void { |
| 1849 | 1849 | ||
| 1850 | pub fn writeMergeSections(self: *Elf) !void { | 1850 | pub fn writeMergeSections(self: *Elf) !void { |
| 1851 | const gpa = self.base.comp.gpa; | 1851 | const gpa = self.base.comp.gpa; |
| 1852 | var buffer = std.ArrayList(u8).init(gpa); | 1852 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 1853 | defer buffer.deinit(); | 1853 | defer buffer.deinit(); |
| 1854 | 1854 | ||
| 1855 | for (self.merge_sections.items) |*msec| { | 1855 | for (self.merge_sections.items) |*msec| { |
| ... | @@ -2214,7 +2214,7 @@ fn sortInitFini(self: *Elf) !void { | ... | @@ -2214,7 +2214,7 @@ fn sortInitFini(self: *Elf) !void { |
| 2214 | } | 2214 | } |
| 2215 | if (!is_init_fini and !is_ctor_dtor) continue; | 2215 | if (!is_init_fini and !is_ctor_dtor) continue; |
| 2216 | 2216 | ||
| 2217 | var entries = std.ArrayList(Entry).init(gpa); | 2217 | var entries = std.array_list.Managed(Entry).init(gpa); |
| 2218 | try entries.ensureTotalCapacityPrecise(atom_list.atoms.keys().len); | 2218 | try entries.ensureTotalCapacityPrecise(atom_list.atoms.keys().len); |
| 2219 | defer entries.deinit(); | 2219 | defer entries.deinit(); |
| 2220 | 2220 | ||
| ... | @@ -2771,7 +2771,7 @@ pub fn allocateAllocSections(self: *Elf) !void { | ... | @@ -2771,7 +2771,7 @@ pub fn allocateAllocSections(self: *Elf) !void { |
| 2771 | // virtual and file offsets. However, the simple one will do for one | 2771 | // virtual and file offsets. However, the simple one will do for one |
| 2772 | // as we are more interested in quick turnaround and compatibility | 2772 | // as we are more interested in quick turnaround and compatibility |
| 2773 | // with `findFreeSpace` mechanics than anything else. | 2773 | // with `findFreeSpace` mechanics than anything else. |
| 2774 | const Cover = std.ArrayList(u32); | 2774 | const Cover = std.array_list.Managed(u32); |
| 2775 | const gpa = self.base.comp.gpa; | 2775 | const gpa = self.base.comp.gpa; |
| 2776 | var covers: [max_number_of_object_segments]Cover = undefined; | 2776 | var covers: [max_number_of_object_segments]Cover = undefined; |
| 2777 | for (&covers) |*cover| { | 2777 | for (&covers) |*cover| { |
| ... | @@ -2999,13 +2999,13 @@ fn allocateSpecialPhdrs(self: *Elf) void { | ... | @@ -2999,13 +2999,13 @@ fn allocateSpecialPhdrs(self: *Elf) void { |
| 2999 | fn writeAtoms(self: *Elf) !void { | 2999 | fn writeAtoms(self: *Elf) !void { |
| 3000 | const gpa = self.base.comp.gpa; | 3000 | const gpa = self.base.comp.gpa; |
| 3001 | 3001 | ||
| 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); |
| 3003 | defer { | 3003 | defer { |
| 3004 | for (undefs.values()) |*refs| refs.deinit(); | 3004 | for (undefs.values()) |*refs| refs.deinit(); |
| 3005 | undefs.deinit(); | 3005 | undefs.deinit(); |
| 3006 | } | 3006 | } |
| 3007 | 3007 | ||
| 3008 | var buffer = std.ArrayList(u8).init(gpa); | 3008 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 3009 | defer buffer.deinit(); | 3009 | defer buffer.deinit(); |
| 3010 | 3010 | ||
| 3011 | const slice = self.sections.slice(); | 3011 | const slice = self.sections.slice(); |
| ... | @@ -3048,7 +3048,7 @@ pub fn updateSymtabSize(self: *Elf) !void { | ... | @@ -3048,7 +3048,7 @@ pub fn updateSymtabSize(self: *Elf) !void { |
| 3048 | const gpa = self.base.comp.gpa; | 3048 | const gpa = self.base.comp.gpa; |
| 3049 | const shared_objects = self.shared_objects.values(); | 3049 | const shared_objects = self.shared_objects.values(); |
| 3050 | 3050 | ||
| 3051 | var files = std.ArrayList(File.Index).init(gpa); | 3051 | var files = std.array_list.Managed(File.Index).init(gpa); |
| 3052 | defer files.deinit(); | 3052 | defer files.deinit(); |
| 3053 | try files.ensureTotalCapacityPrecise(self.objects.items.len + shared_objects.len + 2); | 3053 | try files.ensureTotalCapacityPrecise(self.objects.items.len + shared_objects.len + 2); |
| 3054 | 3054 | ||
| ... | @@ -3166,7 +3166,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3166,7 +3166,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3166 | 3166 | ||
| 3167 | if (self.section_indexes.verneed) |shndx| { | 3167 | if (self.section_indexes.verneed) |shndx| { |
| 3168 | const shdr = slice.items(.shdr)[shndx]; | 3168 | 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()); |
| 3170 | defer buffer.deinit(); | 3170 | defer buffer.deinit(); |
| 3171 | try self.verneed.write(buffer.writer()); | 3171 | try self.verneed.write(buffer.writer()); |
| 3172 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3172 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3174,7 +3174,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3174,7 +3174,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3174 | 3174 | ||
| 3175 | if (self.section_indexes.dynamic) |shndx| { | 3175 | if (self.section_indexes.dynamic) |shndx| { |
| 3176 | const shdr = slice.items(.shdr)[shndx]; | 3176 | 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)); |
| 3178 | defer buffer.deinit(); | 3178 | defer buffer.deinit(); |
| 3179 | try self.dynamic.write(self, buffer.writer()); | 3179 | try self.dynamic.write(self, buffer.writer()); |
| 3180 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3180 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3182,7 +3182,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3182,7 +3182,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3182 | 3182 | ||
| 3183 | if (self.section_indexes.dynsymtab) |shndx| { | 3183 | if (self.section_indexes.dynsymtab) |shndx| { |
| 3184 | const shdr = slice.items(.shdr)[shndx]; | 3184 | 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()); |
| 3186 | defer buffer.deinit(); | 3186 | defer buffer.deinit(); |
| 3187 | try self.dynsym.write(self, buffer.writer()); | 3187 | try self.dynsym.write(self, buffer.writer()); |
| 3188 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3188 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3201,7 +3201,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3201,7 +3201,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3201 | }; | 3201 | }; |
| 3202 | const shdr = slice.items(.shdr)[shndx]; | 3202 | const shdr = slice.items(.shdr)[shndx]; |
| 3203 | const sh_size = try self.cast(usize, shdr.sh_size); | 3203 | 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)); |
| 3205 | defer buffer.deinit(); | 3205 | defer buffer.deinit(); |
| 3206 | try eh_frame.writeEhFrame(self, buffer.writer()); | 3206 | try eh_frame.writeEhFrame(self, buffer.writer()); |
| 3207 | assert(buffer.items.len == sh_size - existing_size); | 3207 | assert(buffer.items.len == sh_size - existing_size); |
| ... | @@ -3211,7 +3211,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3211,7 +3211,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3211 | if (self.section_indexes.eh_frame_hdr) |shndx| { | 3211 | if (self.section_indexes.eh_frame_hdr) |shndx| { |
| 3212 | const shdr = slice.items(.shdr)[shndx]; | 3212 | const shdr = slice.items(.shdr)[shndx]; |
| 3213 | const sh_size = try self.cast(usize, shdr.sh_size); | 3213 | 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); |
| 3215 | defer buffer.deinit(); | 3215 | defer buffer.deinit(); |
| 3216 | try eh_frame.writeEhFrameHdr(self, buffer.writer()); | 3216 | try eh_frame.writeEhFrameHdr(self, buffer.writer()); |
| 3217 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3217 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3219,7 +3219,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3219,7 +3219,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3219 | 3219 | ||
| 3220 | if (self.section_indexes.got) |index| { | 3220 | if (self.section_indexes.got) |index| { |
| 3221 | const shdr = slice.items(.shdr)[index]; | 3221 | 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)); |
| 3223 | defer buffer.deinit(); | 3223 | defer buffer.deinit(); |
| 3224 | try self.got.write(self, buffer.writer()); | 3224 | try self.got.write(self, buffer.writer()); |
| 3225 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3225 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3235,7 +3235,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3235,7 +3235,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3235 | 3235 | ||
| 3236 | if (self.section_indexes.plt) |shndx| { | 3236 | if (self.section_indexes.plt) |shndx| { |
| 3237 | const shdr = slice.items(.shdr)[shndx]; | 3237 | 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)); |
| 3239 | defer buffer.deinit(); | 3239 | defer buffer.deinit(); |
| 3240 | try self.plt.write(self, buffer.writer()); | 3240 | try self.plt.write(self, buffer.writer()); |
| 3241 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3241 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3243,7 +3243,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3243,7 +3243,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3243 | 3243 | ||
| 3244 | if (self.section_indexes.got_plt) |shndx| { | 3244 | if (self.section_indexes.got_plt) |shndx| { |
| 3245 | const shdr = slice.items(.shdr)[shndx]; | 3245 | 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)); |
| 3247 | defer buffer.deinit(); | 3247 | defer buffer.deinit(); |
| 3248 | try self.got_plt.write(self, buffer.writer()); | 3248 | try self.got_plt.write(self, buffer.writer()); |
| 3249 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3249 | try self.pwriteAll(buffer.items, shdr.sh_offset); |
| ... | @@ -3251,7 +3251,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3251,7 +3251,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3251 | 3251 | ||
| 3252 | if (self.section_indexes.plt_got) |shndx| { | 3252 | if (self.section_indexes.plt_got) |shndx| { |
| 3253 | const shdr = slice.items(.shdr)[shndx]; | 3253 | 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)); |
| 3255 | defer buffer.deinit(); | 3255 | defer buffer.deinit(); |
| 3256 | try self.plt_got.write(self, buffer.writer()); | 3256 | try self.plt_got.write(self, buffer.writer()); |
| 3257 | try self.pwriteAll(buffer.items, shdr.sh_offset); | 3257 | 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 { | ... | @@ -221,7 +221,7 @@ pub fn relocs(self: Atom, elf_file: *Elf) []const elf.Elf64_Rela { |
| 221 | } | 221 | } |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.ArrayList(elf.Elf64_Rela)) !void { | 224 | pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.array_list.Managed(elf.Elf64_Rela)) !void { |
| 225 | relocs_log.debug("0x{x}: {s}", .{ self.address(elf_file), self.name(elf_file) }); | 225 | relocs_log.debug("0x{x}: {s}", .{ self.address(elf_file), self.name(elf_file) }); |
| 226 | 226 | ||
| 227 | const cpu_arch = elf_file.getTarget().cpu.arch; | 227 | const cpu_arch = elf_file.getTarget().cpu.arch; |
| ... | @@ -607,7 +607,7 @@ fn reportUndefined( | ... | @@ -607,7 +607,7 @@ fn reportUndefined( |
| 607 | }; | 607 | }; |
| 608 | const gop = try undefs.getOrPut(idx); | 608 | const gop = try undefs.getOrPut(idx); |
| 609 | if (!gop.found_existing) { | 609 | 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); |
| 611 | } | 611 | } |
| 612 | try gop.value_ptr.append(.{ .index = self.atom_index, .file = self.file_index }); | 612 | try gop.value_ptr.append(.{ .index = self.atom_index, .file = self.file_index }); |
| 613 | return true; | 613 | return true; |
src/link/Elf/AtomList.zig+2-2| ... | @@ -89,7 +89,7 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void { | ... | @@ -89,7 +89,7 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void { |
| 89 | list.dirty = false; | 89 | list.dirty = false; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_file: *Elf) !void { | 92 | pub fn write(list: AtomList, buffer: *std.array_list.Managed(u8), undefs: anytype, elf_file: *Elf) !void { |
| 93 | const gpa = elf_file.base.comp.gpa; | 93 | const gpa = elf_file.base.comp.gpa; |
| 94 | const osec = elf_file.sections.items(.shdr)[list.output_section_index]; | 94 | const osec = elf_file.sections.items(.shdr)[list.output_section_index]; |
| 95 | assert(osec.sh_type != elf.SHT_NOBITS); | 95 | assert(osec.sh_type != elf.SHT_NOBITS); |
| ... | @@ -126,7 +126,7 @@ pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_fi | ... | @@ -126,7 +126,7 @@ pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_fi |
| 126 | buffer.clearRetainingCapacity(); | 126 | buffer.clearRetainingCapacity(); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | pub fn writeRelocatable(list: AtomList, buffer: *std.ArrayList(u8), elf_file: *Elf) !void { | 129 | pub fn writeRelocatable(list: AtomList, buffer: *std.array_list.Managed(u8), elf_file: *Elf) !void { |
| 130 | const gpa = elf_file.base.comp.gpa; | 130 | const gpa = elf_file.base.comp.gpa; |
| 131 | const osec = elf_file.sections.items(.shdr)[list.output_section_index]; | 131 | const osec = elf_file.sections.items(.shdr)[list.output_section_index]; |
| 132 | assert(osec.sh_type != elf.SHT_NOBITS); | 132 | 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 { | ... | @@ -423,7 +423,7 @@ pub fn initSymbolAliases(self: *SharedObject, elf_file: *Elf) !void { |
| 423 | 423 | ||
| 424 | const comp = elf_file.base.comp; | 424 | const comp = elf_file.base.comp; |
| 425 | const gpa = comp.gpa; | 425 | const gpa = comp.gpa; |
| 426 | var aliases = std.ArrayList(Symbol.Index).init(gpa); | 426 | var aliases = std.array_list.Managed(Symbol.Index).init(gpa); |
| 427 | defer aliases.deinit(); | 427 | defer aliases.deinit(); |
| 428 | try aliases.ensureTotalCapacityPrecise(self.symbols.items.len); | 428 | try aliases.ensureTotalCapacityPrecise(self.symbols.items.len); |
| 429 | 429 |
src/link/Elf/eh_frame.zig+3-3| ... | @@ -195,7 +195,7 @@ pub fn calcEhFrameSize(elf_file: *Elf) !usize { | ... | @@ -195,7 +195,7 @@ pub fn calcEhFrameSize(elf_file: *Elf) !usize { |
| 195 | break :blk math.cast(usize, sym.atom(elf_file).?.size) orelse return error.Overflow; | 195 | break :blk math.cast(usize, sym.atom(elf_file).?.size) orelse return error.Overflow; |
| 196 | } else 0; | 196 | } else 0; |
| 197 | 197 | ||
| 198 | var cies = std.ArrayList(Cie).init(gpa); | 198 | var cies = std.array_list.Managed(Cie).init(gpa); |
| 199 | defer cies.deinit(); | 199 | defer cies.deinit(); |
| 200 | 200 | ||
| 201 | for (elf_file.objects.items) |index| { | 201 | 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 | ... | @@ -413,7 +413,7 @@ fn emitReloc(elf_file: *Elf, r_offset: u64, sym: *const Symbol, rel: elf.Elf64_R |
| 413 | }; | 413 | }; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | pub fn writeEhFrameRelocs(elf_file: *Elf, relocs: *std.ArrayList(elf.Elf64_Rela)) !void { | 416 | pub fn writeEhFrameRelocs(elf_file: *Elf, relocs: *std.array_list.Managed(elf.Elf64_Rela)) !void { |
| 417 | relocs_log.debug("{x}: .eh_frame", .{ | 417 | relocs_log.debug("{x}: .eh_frame", .{ |
| 418 | elf_file.sections.items(.shdr)[elf_file.section_indexes.eh_frame.?].sh_addr, | 418 | elf_file.sections.items(.shdr)[elf_file.section_indexes.eh_frame.?].sh_addr, |
| 419 | }); | 419 | }); |
| ... | @@ -493,7 +493,7 @@ pub fn writeEhFrameHdr(elf_file: *Elf, writer: anytype) !void { | ... | @@ -493,7 +493,7 @@ pub fn writeEhFrameHdr(elf_file: *Elf, writer: anytype) !void { |
| 493 | } | 493 | } |
| 494 | }; | 494 | }; |
| 495 | 495 | ||
| 496 | var entries = std.ArrayList(Entry).init(gpa); | 496 | var entries = std.array_list.Managed(Entry).init(gpa); |
| 497 | defer entries.deinit(); | 497 | defer entries.deinit(); |
| 498 | try entries.ensureTotalCapacityPrecise(num_fdes); | 498 | try entries.ensureTotalCapacityPrecise(num_fdes); |
| 499 | 499 |
src/link/Elf/gc.zig+4-4| ... | @@ -1,14 +1,14 @@ | ... | @@ -1,14 +1,14 @@ |
| 1 | pub fn gcAtoms(elf_file: *Elf) !void { | 1 | pub fn gcAtoms(elf_file: *Elf) !void { |
| 2 | const comp = elf_file.base.comp; | 2 | const comp = elf_file.base.comp; |
| 3 | const gpa = comp.gpa; | 3 | const gpa = comp.gpa; |
| 4 | var roots = std.ArrayList(*Atom).init(gpa); | 4 | var roots = std.array_list.Managed(*Atom).init(gpa); |
| 5 | defer roots.deinit(); | 5 | defer roots.deinit(); |
| 6 | try collectRoots(&roots, elf_file); | 6 | try collectRoots(&roots, elf_file); |
| 7 | mark(roots, elf_file); | 7 | mark(roots, elf_file); |
| 8 | prune(elf_file); | 8 | prune(elf_file); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | fn collectRoots(roots: *std.ArrayList(*Atom), elf_file: *Elf) !void { | 11 | fn collectRoots(roots: *std.array_list.Managed(*Atom), elf_file: *Elf) !void { |
| 12 | if (elf_file.linkerDefinedPtr()) |obj| { | 12 | if (elf_file.linkerDefinedPtr()) |obj| { |
| 13 | if (obj.entrySymbol(elf_file)) |sym| { | 13 | if (obj.entrySymbol(elf_file)) |sym| { |
| 14 | try markSymbol(sym, roots, elf_file); | 14 | try markSymbol(sym, roots, elf_file); |
| ... | @@ -82,7 +82,7 @@ fn collectRoots(roots: *std.ArrayList(*Atom), elf_file: *Elf) !void { | ... | @@ -82,7 +82,7 @@ fn collectRoots(roots: *std.ArrayList(*Atom), elf_file: *Elf) !void { |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | fn markSymbol(sym: *Symbol, roots: *std.ArrayList(*Atom), elf_file: *Elf) !void { | 85 | fn markSymbol(sym: *Symbol, roots: *std.array_list.Managed(*Atom), elf_file: *Elf) !void { |
| 86 | if (sym.mergeSubsection(elf_file)) |msub| { | 86 | if (sym.mergeSubsection(elf_file)) |msub| { |
| 87 | msub.alive = true; | 87 | msub.alive = true; |
| 88 | return; | 88 | return; |
| ... | @@ -133,7 +133,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void { | ... | @@ -133,7 +133,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void { |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | fn mark(roots: std.ArrayList(*Atom), elf_file: *Elf) void { | 136 | fn mark(roots: std.array_list.Managed(*Atom), elf_file: *Elf) void { |
| 137 | for (roots.items) |root| { | 137 | for (roots.items) |root| { |
| 138 | gc_track_live_log.debug("root atom({d})", .{root.atom_index}); | 138 | gc_track_live_log.debug("root atom({d})", .{root.atom_index}); |
| 139 | markLive(root, elf_file); | 139 | markLive(root, elf_file); |
src/link/Elf/relocatable.zig+7-7| ... | @@ -44,7 +44,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { | ... | @@ -44,7 +44,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { |
| 44 | try zig_object.readFileContents(elf_file); | 44 | try zig_object.readFileContents(elf_file); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | var files = std.ArrayList(File.Index).init(gpa); | 47 | var files = std.array_list.Managed(File.Index).init(gpa); |
| 48 | defer files.deinit(); | 48 | defer files.deinit(); |
| 49 | try files.ensureTotalCapacityPrecise(elf_file.objects.items.len + 1); | 49 | try files.ensureTotalCapacityPrecise(elf_file.objects.items.len + 1); |
| 50 | if (elf_file.zigObjectPtr()) |zig_object| files.appendAssumeCapacity(zig_object.index); | 50 | if (elf_file.zigObjectPtr()) |zig_object| files.appendAssumeCapacity(zig_object.index); |
| ... | @@ -100,7 +100,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { | ... | @@ -100,7 +100,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { |
| 100 | state_log.debug("ar_strtab\n{f}\n", .{ar_strtab}); | 100 | state_log.debug("ar_strtab\n{f}\n", .{ar_strtab}); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | var buffer = std.ArrayList(u8).init(gpa); | 103 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 104 | defer buffer.deinit(); | 104 | defer buffer.deinit(); |
| 105 | try buffer.ensureTotalCapacityPrecise(total_size); | 105 | try buffer.ensureTotalCapacityPrecise(total_size); |
| 106 | 106 | ||
| ... | @@ -347,7 +347,7 @@ fn allocateAllocSections(elf_file: *Elf) !void { | ... | @@ -347,7 +347,7 @@ fn allocateAllocSections(elf_file: *Elf) !void { |
| 347 | fn writeAtoms(elf_file: *Elf) !void { | 347 | fn writeAtoms(elf_file: *Elf) !void { |
| 348 | const gpa = elf_file.base.comp.gpa; | 348 | const gpa = elf_file.base.comp.gpa; |
| 349 | 349 | ||
| 350 | var buffer = std.ArrayList(u8).init(gpa); | 350 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 351 | defer buffer.deinit(); | 351 | defer buffer.deinit(); |
| 352 | 352 | ||
| 353 | const slice = elf_file.sections.slice(); | 353 | const slice = elf_file.sections.slice(); |
| ... | @@ -377,7 +377,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void { | ... | @@ -377,7 +377,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void { |
| 377 | 377 | ||
| 378 | const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse | 378 | const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse |
| 379 | return error.Overflow; | 379 | 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); |
| 381 | defer relocs.deinit(); | 381 | defer relocs.deinit(); |
| 382 | 382 | ||
| 383 | for (atom_list.items) |ref| { | 383 | for (atom_list.items) |ref| { |
| ... | @@ -407,7 +407,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void { | ... | @@ -407,7 +407,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void { |
| 407 | }; | 407 | }; |
| 408 | const shdr = slice.items(.shdr)[shndx]; | 408 | const shdr = slice.items(.shdr)[shndx]; |
| 409 | const sh_size = math.cast(usize, shdr.sh_size) orelse return error.Overflow; | 409 | 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)); |
| 411 | defer buffer.deinit(); | 411 | defer buffer.deinit(); |
| 412 | try eh_frame.writeEhFrameRelocatable(elf_file, buffer.writer()); | 412 | try eh_frame.writeEhFrameRelocatable(elf_file, buffer.writer()); |
| 413 | log.debug("writing .eh_frame from 0x{x} to 0x{x}", .{ | 413 | log.debug("writing .eh_frame from 0x{x} to 0x{x}", .{ |
| ... | @@ -421,7 +421,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void { | ... | @@ -421,7 +421,7 @@ fn writeSyntheticSections(elf_file: *Elf) !void { |
| 421 | const shdr = slice.items(.shdr)[shndx]; | 421 | const shdr = slice.items(.shdr)[shndx]; |
| 422 | const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse | 422 | const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse |
| 423 | return error.Overflow; | 423 | 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); |
| 425 | defer relocs.deinit(); | 425 | defer relocs.deinit(); |
| 426 | try eh_frame.writeEhFrameRelocs(elf_file, &relocs); | 426 | try eh_frame.writeEhFrameRelocs(elf_file, &relocs); |
| 427 | assert(relocs.items.len == num_relocs); | 427 | assert(relocs.items.len == num_relocs); |
| ... | @@ -446,7 +446,7 @@ fn writeGroups(elf_file: *Elf) !void { | ... | @@ -446,7 +446,7 @@ fn writeGroups(elf_file: *Elf) !void { |
| 446 | for (elf_file.group_sections.items) |cgs| { | 446 | for (elf_file.group_sections.items) |cgs| { |
| 447 | const shdr = elf_file.sections.items(.shdr)[cgs.shndx]; | 447 | const shdr = elf_file.sections.items(.shdr)[cgs.shndx]; |
| 448 | const sh_size = math.cast(usize, shdr.sh_size) orelse return error.Overflow; | 448 | 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); |
| 450 | defer buffer.deinit(); | 450 | defer buffer.deinit(); |
| 451 | try cgs.write(elf_file, buffer.writer()); | 451 | try cgs.write(elf_file, buffer.writer()); |
| 452 | assert(buffer.items.len == sh_size); | 452 | assert(buffer.items.len == sh_size); |
src/link/Elf/synthetic_sections.zig+2-2| ... | @@ -18,7 +18,7 @@ pub const DynamicSection = struct { | ... | @@ -18,7 +18,7 @@ pub const DynamicSection = struct { |
| 18 | if (rpath_list.len == 0) return; | 18 | if (rpath_list.len == 0) return; |
| 19 | const comp = elf_file.base.comp; | 19 | const comp = elf_file.base.comp; |
| 20 | const gpa = comp.gpa; | 20 | const gpa = comp.gpa; |
| 21 | var rpath = std.ArrayList(u8).init(gpa); | 21 | var rpath = std.array_list.Managed(u8).init(gpa); |
| 22 | defer rpath.deinit(); | 22 | defer rpath.deinit(); |
| 23 | for (rpath_list, 0..) |path, i| { | 23 | for (rpath_list, 0..) |path, i| { |
| 24 | if (i > 0) try rpath.append(':'); | 24 | if (i > 0) try rpath.append(':'); |
| ... | @@ -1350,7 +1350,7 @@ pub const VerneedSection = struct { | ... | @@ -1350,7 +1350,7 @@ pub const VerneedSection = struct { |
| 1350 | 1350 | ||
| 1351 | const comp = elf_file.base.comp; | 1351 | const comp = elf_file.base.comp; |
| 1352 | const gpa = comp.gpa; | 1352 | const gpa = comp.gpa; |
| 1353 | var verneed = std.ArrayList(VersionedSymbol).init(gpa); | 1353 | var verneed = std.array_list.Managed(VersionedSymbol).init(gpa); |
| 1354 | defer verneed.deinit(); | 1354 | defer verneed.deinit(); |
| 1355 | try verneed.ensureTotalCapacity(dynsyms.len); | 1355 | try verneed.ensureTotalCapacity(dynsyms.len); |
| 1356 | 1356 |
src/link/Lld.zig+3-3| ... | @@ -409,7 +409,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -409,7 +409,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 409 | ); | 409 | ); |
| 410 | } else { | 410 | } else { |
| 411 | // Create an LLD command line and invoke it. | 411 | // 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); |
| 413 | defer argv.deinit(); | 413 | defer argv.deinit(); |
| 414 | // We will invoke ourselves as a child process to gain access to LLD. | 414 | // We will invoke ourselves as a child process to gain access to LLD. |
| 415 | // This is necessary because LLD does not behave properly as a library - | 415 | // This is necessary because LLD does not behave properly as a library - |
| ... | @@ -863,7 +863,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -863,7 +863,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 863 | ); | 863 | ); |
| 864 | } else { | 864 | } else { |
| 865 | // Create an LLD command line and invoke it. | 865 | // 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); |
| 867 | defer argv.deinit(); | 867 | defer argv.deinit(); |
| 868 | // We will invoke ourselves as a child process to gain access to LLD. | 868 | // We will invoke ourselves as a child process to gain access to LLD. |
| 869 | // This is necessary because LLD does not behave properly as a library - | 869 | // This is necessary because LLD does not behave properly as a library - |
| ... | @@ -1412,7 +1412,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -1412,7 +1412,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { |
| 1412 | ); | 1412 | ); |
| 1413 | } else { | 1413 | } else { |
| 1414 | // Create an LLD command line and invoke it. | 1414 | // 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); |
| 1416 | defer argv.deinit(); | 1416 | defer argv.deinit(); |
| 1417 | // We will invoke ourselves as a child process to gain access to LLD. | 1417 | // We will invoke ourselves as a child process to gain access to LLD. |
| 1418 | // This is necessary because LLD does not behave properly as a library - | 1418 | // 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( | ... | @@ -359,7 +359,7 @@ pub fn flush( |
| 359 | if (self.base.isStaticLib()) return relocatable.flushStaticLib(self, comp, zcu_obj_path); | 359 | if (self.base.isStaticLib()) return relocatable.flushStaticLib(self, comp, zcu_obj_path); |
| 360 | if (self.base.isObject()) return relocatable.flushObject(self, comp, zcu_obj_path); | 360 | if (self.base.isObject()) return relocatable.flushObject(self, comp, zcu_obj_path); |
| 361 | 361 | ||
| 362 | var positionals = std.ArrayList(link.Input).init(gpa); | 362 | var positionals = std.array_list.Managed(link.Input).init(gpa); |
| 363 | defer positionals.deinit(); | 363 | defer positionals.deinit(); |
| 364 | 364 | ||
| 365 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); | 365 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); |
| ... | @@ -404,7 +404,7 @@ pub fn flush( | ... | @@ -404,7 +404,7 @@ pub fn flush( |
| 404 | diags.addParseError(link_input.path().?, "failed to read input file: {s}", .{@errorName(err)}); | 404 | diags.addParseError(link_input.path().?, "failed to read input file: {s}", .{@errorName(err)}); |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | var system_libs = std.ArrayList(SystemLib).init(gpa); | 407 | var system_libs = std.array_list.Managed(SystemLib).init(gpa); |
| 408 | defer system_libs.deinit(); | 408 | defer system_libs.deinit(); |
| 409 | 409 | ||
| 410 | // frameworks | 410 | // frameworks |
| ... | @@ -632,7 +632,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { | ... | @@ -632,7 +632,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { |
| 632 | break :p try p.toString(arena); | 632 | break :p try p.toString(arena); |
| 633 | } else null; | 633 | } else null; |
| 634 | 634 | ||
| 635 | var argv = std.ArrayList([]const u8).init(arena); | 635 | var argv = std.array_list.Managed([]const u8).init(arena); |
| 636 | 636 | ||
| 637 | try argv.append("zig"); | 637 | try argv.append("zig"); |
| 638 | 638 | ||
| ... | @@ -827,8 +827,8 @@ pub fn resolveLibSystem( | ... | @@ -827,8 +827,8 @@ pub fn resolveLibSystem( |
| 827 | ) !void { | 827 | ) !void { |
| 828 | const diags = &self.base.comp.link_diags; | 828 | const diags = &self.base.comp.link_diags; |
| 829 | 829 | ||
| 830 | var test_path = std.ArrayList(u8).init(arena); | 830 | var test_path = std.array_list.Managed(u8).init(arena); |
| 831 | var checked_paths = std.ArrayList([]const u8).init(arena); | 831 | var checked_paths = std.array_list.Managed([]const u8).init(arena); |
| 832 | 832 | ||
| 833 | success: { | 833 | success: { |
| 834 | if (self.sdk_layout) |sdk_layout| switch (sdk_layout) { | 834 | if (self.sdk_layout) |sdk_layout| switch (sdk_layout) { |
| ... | @@ -1065,8 +1065,8 @@ fn isHoisted(self: *MachO, install_name: []const u8) bool { | ... | @@ -1065,8 +1065,8 @@ fn isHoisted(self: *MachO, install_name: []const u8) bool { |
| 1065 | /// TODO delete this, libraries must be instead resolved when instantiating the compilation pipeline | 1065 | /// TODO delete this, libraries must be instead resolved when instantiating the compilation pipeline |
| 1066 | fn accessLibPath( | 1066 | fn accessLibPath( |
| 1067 | arena: Allocator, | 1067 | arena: Allocator, |
| 1068 | test_path: *std.ArrayList(u8), | 1068 | test_path: *std.array_list.Managed(u8), |
| 1069 | checked_paths: *std.ArrayList([]const u8), | 1069 | checked_paths: *std.array_list.Managed([]const u8), |
| 1070 | search_dir: []const u8, | 1070 | search_dir: []const u8, |
| 1071 | name: []const u8, | 1071 | name: []const u8, |
| 1072 | ) !bool { | 1072 | ) !bool { |
| ... | @@ -1088,8 +1088,8 @@ fn accessLibPath( | ... | @@ -1088,8 +1088,8 @@ fn accessLibPath( |
| 1088 | 1088 | ||
| 1089 | fn accessFrameworkPath( | 1089 | fn accessFrameworkPath( |
| 1090 | arena: Allocator, | 1090 | arena: Allocator, |
| 1091 | test_path: *std.ArrayList(u8), | 1091 | test_path: *std.array_list.Managed(u8), |
| 1092 | checked_paths: *std.ArrayList([]const u8), | 1092 | checked_paths: *std.array_list.Managed([]const u8), |
| 1093 | search_dir: []const u8, | 1093 | search_dir: []const u8, |
| 1094 | name: []const u8, | 1094 | name: []const u8, |
| 1095 | ) !bool { | 1095 | ) !bool { |
| ... | @@ -1138,7 +1138,7 @@ fn parseDependentDylibs(self: *MachO) !void { | ... | @@ -1138,7 +1138,7 @@ fn parseDependentDylibs(self: *MachO) !void { |
| 1138 | while (index < self.dylibs.items.len) : (index += 1) { | 1138 | while (index < self.dylibs.items.len) : (index += 1) { |
| 1139 | const dylib_index = self.dylibs.items[index]; | 1139 | const dylib_index = self.dylibs.items[index]; |
| 1140 | 1140 | ||
| 1141 | var dependents = std.ArrayList(File.Index).init(gpa); | 1141 | var dependents = std.array_list.Managed(File.Index).init(gpa); |
| 1142 | defer dependents.deinit(); | 1142 | defer dependents.deinit(); |
| 1143 | try dependents.ensureTotalCapacityPrecise(self.getFile(dylib_index).?.dylib.dependents.items.len); | 1143 | try dependents.ensureTotalCapacityPrecise(self.getFile(dylib_index).?.dylib.dependents.items.len); |
| 1144 | 1144 | ||
| ... | @@ -1151,8 +1151,8 @@ fn parseDependentDylibs(self: *MachO) !void { | ... | @@ -1151,8 +1151,8 @@ fn parseDependentDylibs(self: *MachO) !void { |
| 1151 | // 3. If name is a relative path, substitute @rpath, @loader_path, @executable_path with | 1151 | // 3. If name is a relative path, substitute @rpath, @loader_path, @executable_path with |
| 1152 | // dependees list of rpaths, and search there. | 1152 | // dependees list of rpaths, and search there. |
| 1153 | // 4. Finally, just search the provided relative path directly in CWD. | 1153 | // 4. Finally, just search the provided relative path directly in CWD. |
| 1154 | var test_path = std.ArrayList(u8).init(arena); | 1154 | var test_path = std.array_list.Managed(u8).init(arena); |
| 1155 | var checked_paths = std.ArrayList([]const u8).init(arena); | 1155 | var checked_paths = std.array_list.Managed([]const u8).init(arena); |
| 1156 | 1156 | ||
| 1157 | const full_path = full_path: { | 1157 | const full_path = full_path: { |
| 1158 | { | 1158 | { |
| ... | @@ -1550,7 +1550,7 @@ fn reportUndefs(self: *MachO) !void { | ... | @@ -1550,7 +1550,7 @@ fn reportUndefs(self: *MachO) !void { |
| 1550 | const max_notes = 4; | 1550 | const max_notes = 4; |
| 1551 | 1551 | ||
| 1552 | // We will sort by name, and then by file to ensure deterministic output. | 1552 | // 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); |
| 1554 | defer keys.deinit(); | 1554 | defer keys.deinit(); |
| 1555 | keys.appendSliceAssumeCapacity(self.undefs.keys()); | 1555 | keys.appendSliceAssumeCapacity(self.undefs.keys()); |
| 1556 | self.sortGlobalSymbolsByName(keys.items); | 1556 | self.sortGlobalSymbolsByName(keys.items); |
| ... | @@ -1813,7 +1813,7 @@ pub fn sortSections(self: *MachO) !void { | ... | @@ -1813,7 +1813,7 @@ pub fn sortSections(self: *MachO) !void { |
| 1813 | 1813 | ||
| 1814 | const gpa = self.base.comp.gpa; | 1814 | const gpa = self.base.comp.gpa; |
| 1815 | 1815 | ||
| 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); |
| 1817 | defer entries.deinit(); | 1817 | defer entries.deinit(); |
| 1818 | for (0..self.sections.slice().len) |index| { | 1818 | for (0..self.sections.slice().len) |index| { |
| 1819 | entries.appendAssumeCapacity(.{ .index = @intCast(index) }); | 1819 | entries.appendAssumeCapacity(.{ .index = @intCast(index) }); |
| ... | @@ -2123,7 +2123,7 @@ fn initSegments(self: *MachO) !void { | ... | @@ -2123,7 +2123,7 @@ fn initSegments(self: *MachO) !void { |
| 2123 | } | 2123 | } |
| 2124 | }; | 2124 | }; |
| 2125 | 2125 | ||
| 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); |
| 2127 | defer entries.deinit(); | 2127 | defer entries.deinit(); |
| 2128 | for (0..self.segments.items.len) |index| { | 2128 | for (0..self.segments.items.len) |index| { |
| 2129 | entries.appendAssumeCapacity(.{ .index = @intCast(index) }); | 2129 | entries.appendAssumeCapacity(.{ .index = @intCast(index) }); |
| ... | @@ -2689,7 +2689,7 @@ pub fn writeDataInCode(self: *MachO) !void { | ... | @@ -2689,7 +2689,7 @@ pub fn writeDataInCode(self: *MachO) !void { |
| 2689 | defer tracy.end(); | 2689 | defer tracy.end(); |
| 2690 | const gpa = self.base.comp.gpa; | 2690 | const gpa = self.base.comp.gpa; |
| 2691 | const cmd = self.data_in_code_cmd; | 2691 | 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()); |
| 2693 | defer buffer.deinit(); | 2693 | defer buffer.deinit(); |
| 2694 | try self.data_in_code.write(self, buffer.writer()); | 2694 | try self.data_in_code.write(self, buffer.writer()); |
| 2695 | try self.pwriteAll(buffer.items, cmd.dataoff); | 2695 | try self.pwriteAll(buffer.items, cmd.dataoff); |
| ... | @@ -2701,7 +2701,7 @@ fn writeIndsymtab(self: *MachO) !void { | ... | @@ -2701,7 +2701,7 @@ fn writeIndsymtab(self: *MachO) !void { |
| 2701 | const gpa = self.base.comp.gpa; | 2701 | const gpa = self.base.comp.gpa; |
| 2702 | const cmd = self.dysymtab_cmd; | 2702 | const cmd = self.dysymtab_cmd; |
| 2703 | const needed_size = cmd.nindirectsyms * @sizeOf(u32); | 2703 | 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); |
| 2705 | defer buffer.deinit(); | 2705 | defer buffer.deinit(); |
| 2706 | try self.indsymtab.write(self, buffer.writer()); | 2706 | try self.indsymtab.write(self, buffer.writer()); |
| 2707 | try self.pwriteAll(buffer.items, cmd.indirectsymoff); | 2707 | try self.pwriteAll(buffer.items, cmd.indirectsymoff); |
| ... | @@ -2746,7 +2746,7 @@ fn calcSymtabSize(self: *MachO) !void { | ... | @@ -2746,7 +2746,7 @@ fn calcSymtabSize(self: *MachO) !void { |
| 2746 | 2746 | ||
| 2747 | const gpa = self.base.comp.gpa; | 2747 | const gpa = self.base.comp.gpa; |
| 2748 | 2748 | ||
| 2749 | var files = std.ArrayList(File.Index).init(gpa); | 2749 | var files = std.array_list.Managed(File.Index).init(gpa); |
| 2750 | defer files.deinit(); | 2750 | defer files.deinit(); |
| 2751 | try files.ensureTotalCapacityPrecise(self.objects.items.len + self.dylibs.items.len + 2); | 2751 | try files.ensureTotalCapacityPrecise(self.objects.items.len + self.dylibs.items.len + 2); |
| 2752 | if (self.zig_object) |index| files.appendAssumeCapacity(index); | 2752 | if (self.zig_object) |index| files.appendAssumeCapacity(index); |
| ... | @@ -3015,7 +3015,7 @@ pub fn writeCodeSignature(self: *MachO, code_sig: *CodeSignature) !void { | ... | @@ -3015,7 +3015,7 @@ pub fn writeCodeSignature(self: *MachO, code_sig: *CodeSignature) !void { |
| 3015 | const seg = self.getTextSegment(); | 3015 | const seg = self.getTextSegment(); |
| 3016 | const offset = self.codesig_cmd.dataoff; | 3016 | const offset = self.codesig_cmd.dataoff; |
| 3017 | 3017 | ||
| 3018 | var buffer = std.ArrayList(u8).init(self.base.comp.gpa); | 3018 | var buffer = std.array_list.Managed(u8).init(self.base.comp.gpa); |
| 3019 | defer buffer.deinit(); | 3019 | defer buffer.deinit(); |
| 3020 | try buffer.ensureTotalCapacityPrecise(code_sig.size()); | 3020 | try buffer.ensureTotalCapacityPrecise(code_sig.size()); |
| 3021 | try code_sig.writeAdhocSignature(self, .{ | 3021 | try code_sig.writeAdhocSignature(self, .{ |
| ... | @@ -3837,7 +3837,7 @@ fn reportDuplicates(self: *MachO) error{ HasDuplicates, OutOfMemory }!void { | ... | @@ -3837,7 +3837,7 @@ fn reportDuplicates(self: *MachO) error{ HasDuplicates, OutOfMemory }!void { |
| 3837 | const max_notes = 3; | 3837 | const max_notes = 3; |
| 3838 | 3838 | ||
| 3839 | // We will sort by name, and then by file to ensure deterministic output. | 3839 | // 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); |
| 3841 | defer keys.deinit(); | 3841 | defer keys.deinit(); |
| 3842 | keys.appendSliceAssumeCapacity(self.dupes.keys()); | 3842 | keys.appendSliceAssumeCapacity(self.dupes.keys()); |
| 3843 | self.sortGlobalSymbolsByName(keys.items); | 3843 | self.sortGlobalSymbolsByName(keys.items); |
| ... | @@ -4269,7 +4269,7 @@ pub const Platform = struct { | ... | @@ -4269,7 +4269,7 @@ pub const Platform = struct { |
| 4269 | 4269 | ||
| 4270 | /// Caller owns the memory. | 4270 | /// Caller owns the memory. |
| 4271 | pub fn allocPrintTarget(plat: Platform, gpa: Allocator, cpu_arch: std.Target.Cpu.Arch) error{OutOfMemory}![]u8 { | 4271 | 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); |
| 4273 | defer buffer.deinit(); | 4273 | defer buffer.deinit(); |
| 4274 | try buffer.writer().print("{f}", .{plat.fmtTarget(cpu_arch)}); | 4274 | try buffer.writer().print("{f}", .{plat.fmtTarget(cpu_arch)}); |
| 4275 | return buffer.toOwnedSlice(); | 4275 | return buffer.toOwnedSlice(); |
src/link/MachO/CodeSignature.zig+3-3| ... | @@ -276,7 +276,7 @@ pub fn writeAdhocSignature( | ... | @@ -276,7 +276,7 @@ pub fn writeAdhocSignature( |
| 276 | .count = 0, | 276 | .count = 0, |
| 277 | }; | 277 | }; |
| 278 | 278 | ||
| 279 | var blobs = std.ArrayList(Blob).init(allocator); | 279 | var blobs = std.array_list.Managed(Blob).init(allocator); |
| 280 | defer blobs.deinit(); | 280 | defer blobs.deinit(); |
| 281 | 281 | ||
| 282 | self.code_directory.inner.execSegBase = opts.exec_seg_base; | 282 | self.code_directory.inner.execSegBase = opts.exec_seg_base; |
| ... | @@ -304,7 +304,7 @@ pub fn writeAdhocSignature( | ... | @@ -304,7 +304,7 @@ pub fn writeAdhocSignature( |
| 304 | var hash: [hash_size]u8 = undefined; | 304 | var hash: [hash_size]u8 = undefined; |
| 305 | 305 | ||
| 306 | if (self.requirements) |*req| { | 306 | if (self.requirements) |*req| { |
| 307 | var buf = std.ArrayList(u8).init(allocator); | 307 | var buf = std.array_list.Managed(u8).init(allocator); |
| 308 | defer buf.deinit(); | 308 | defer buf.deinit(); |
| 309 | try req.write(buf.writer()); | 309 | try req.write(buf.writer()); |
| 310 | Sha256.hash(buf.items, &hash, .{}); | 310 | Sha256.hash(buf.items, &hash, .{}); |
| ... | @@ -316,7 +316,7 @@ pub fn writeAdhocSignature( | ... | @@ -316,7 +316,7 @@ pub fn writeAdhocSignature( |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | if (self.entitlements) |*ents| { | 318 | if (self.entitlements) |*ents| { |
| 319 | var buf = std.ArrayList(u8).init(allocator); | 319 | var buf = std.array_list.Managed(u8).init(allocator); |
| 320 | defer buf.deinit(); | 320 | defer buf.deinit(); |
| 321 | try ents.write(buf.writer()); | 321 | try ents.write(buf.writer()); |
| 322 | Sha256.hash(buf.items, &hash, .{}); | 322 | Sha256.hash(buf.items, &hash, .{}); |
src/link/MachO/Dylib.zig+1-1| ... | @@ -814,7 +814,7 @@ pub const TargetMatcher = struct { | ... | @@ -814,7 +814,7 @@ pub const TargetMatcher = struct { |
| 814 | 814 | ||
| 815 | const targets = switch (tbd) { | 815 | const targets = switch (tbd) { |
| 816 | .v3 => |v3| blk: { | 816 | .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()); |
| 818 | for (v3.archs) |arch| { | 818 | for (v3.archs) |arch| { |
| 819 | if (mem.eql(u8, v3.platform, "zippered")) { | 819 | if (mem.eql(u8, v3.platform, "zippered")) { |
| 820 | // From Xcode 10.3 → 11.3.1, macos SDK .tbd files specify platform as 'zippered' | 820 | // 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 | ... | @@ -402,7 +402,7 @@ pub fn resolveLiterals(self: *InternalObject, lp: *MachO.LiteralPool, macho_file |
| 402 | 402 | ||
| 403 | const gpa = macho_file.base.comp.gpa; | 403 | const gpa = macho_file.base.comp.gpa; |
| 404 | 404 | ||
| 405 | var buffer = std.ArrayList(u8).init(gpa); | 405 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 406 | defer buffer.deinit(); | 406 | defer buffer.deinit(); |
| 407 | 407 | ||
| 408 | const slice = self.sections.slice(); | 408 | 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 { | ... | @@ -199,7 +199,7 @@ pub fn parse(self: *Object, macho_file: *MachO) !void { |
| 199 | } | 199 | } |
| 200 | }; | 200 | }; |
| 201 | 201 | ||
| 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); |
| 203 | defer nlists.deinit(); | 203 | defer nlists.deinit(); |
| 204 | for (self.symtab.items(.nlist), 0..) |nlist, i| { | 204 | for (self.symtab.items(.nlist), 0..) |nlist, i| { |
| 205 | if (nlist.stab() or !nlist.sect()) continue; | 205 | if (nlist.stab() or !nlist.sect()) continue; |
| ... | @@ -633,7 +633,7 @@ pub fn resolveLiterals(self: *Object, lp: *MachO.LiteralPool, macho_file: *MachO | ... | @@ -633,7 +633,7 @@ pub fn resolveLiterals(self: *Object, lp: *MachO.LiteralPool, macho_file: *MachO |
| 633 | const gpa = macho_file.base.comp.gpa; | 633 | const gpa = macho_file.base.comp.gpa; |
| 634 | const file = macho_file.getFileHandle(self.file_handle); | 634 | const file = macho_file.getFileHandle(self.file_handle); |
| 635 | 635 | ||
| 636 | var buffer = std.ArrayList(u8).init(gpa); | 636 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 637 | defer buffer.deinit(); | 637 | defer buffer.deinit(); |
| 638 | 638 | ||
| 639 | var sections_data = std.AutoHashMap(u32, []const u8).init(gpa); | 639 | var sections_data = std.AutoHashMap(u32, []const u8).init(gpa); |
src/link/MachO/dead_strip.zig+4-4| ... | @@ -1,12 +1,12 @@ | ... | @@ -1,12 +1,12 @@ |
| 1 | pub fn gcAtoms(macho_file: *MachO) !void { | 1 | pub fn gcAtoms(macho_file: *MachO) !void { |
| 2 | const gpa = macho_file.base.comp.gpa; | 2 | const gpa = macho_file.base.comp.gpa; |
| 3 | 3 | ||
| 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); |
| 5 | defer objects.deinit(); | 5 | defer objects.deinit(); |
| 6 | for (macho_file.objects.items) |index| objects.appendAssumeCapacity(index); | 6 | for (macho_file.objects.items) |index| objects.appendAssumeCapacity(index); |
| 7 | if (macho_file.internal_object) |index| objects.appendAssumeCapacity(index); | 7 | if (macho_file.internal_object) |index| objects.appendAssumeCapacity(index); |
| 8 | 8 | ||
| 9 | var roots = std.ArrayList(*Atom).init(gpa); | 9 | var roots = std.array_list.Managed(*Atom).init(gpa); |
| 10 | defer roots.deinit(); | 10 | defer roots.deinit(); |
| 11 | 11 | ||
| 12 | try collectRoots(&roots, objects.items, macho_file); | 12 | try collectRoots(&roots, objects.items, macho_file); |
| ... | @@ -14,7 +14,7 @@ pub fn gcAtoms(macho_file: *MachO) !void { | ... | @@ -14,7 +14,7 @@ pub fn gcAtoms(macho_file: *MachO) !void { |
| 14 | prune(objects.items, macho_file); | 14 | prune(objects.items, macho_file); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | fn collectRoots(roots: *std.ArrayList(*Atom), objects: []const File.Index, macho_file: *MachO) !void { | 17 | fn collectRoots(roots: *std.array_list.Managed(*Atom), objects: []const File.Index, macho_file: *MachO) !void { |
| 18 | for (objects) |index| { | 18 | for (objects) |index| { |
| 19 | const object = macho_file.getFile(index).?; | 19 | const object = macho_file.getFile(index).?; |
| 20 | for (object.getSymbols(), 0..) |*sym, i| { | 20 | for (object.getSymbols(), 0..) |*sym, i| { |
| ... | @@ -76,7 +76,7 @@ fn collectRoots(roots: *std.ArrayList(*Atom), objects: []const File.Index, macho | ... | @@ -76,7 +76,7 @@ fn collectRoots(roots: *std.ArrayList(*Atom), objects: []const File.Index, macho |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | fn markSymbol(sym: *Symbol, roots: *std.ArrayList(*Atom), macho_file: *MachO) !void { | 79 | fn markSymbol(sym: *Symbol, roots: *std.array_list.Managed(*Atom), macho_file: *MachO) !void { |
| 80 | const atom = sym.getAtom(macho_file) orelse return; | 80 | const atom = sym.getAtom(macho_file) orelse return; |
| 81 | if (markAtom(atom)) try roots.append(atom); | 81 | if (markAtom(atom)) try roots.append(atom); |
| 82 | } | 82 | } |
src/link/MachO/dyld_info/Rebase.zig+1-1| ... | @@ -25,7 +25,7 @@ pub fn updateSize(rebase: *Rebase, macho_file: *MachO) !void { | ... | @@ -25,7 +25,7 @@ pub fn updateSize(rebase: *Rebase, macho_file: *MachO) !void { |
| 25 | 25 | ||
| 26 | const gpa = macho_file.base.comp.gpa; | 26 | const gpa = macho_file.base.comp.gpa; |
| 27 | 27 | ||
| 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); |
| 29 | defer objects.deinit(); | 29 | defer objects.deinit(); |
| 30 | objects.appendSliceAssumeCapacity(macho_file.objects.items); | 30 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
| 31 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); | 31 | 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 { | ... | @@ -134,7 +134,7 @@ fn finalize(self: *Trie, allocator: Allocator) !void { |
| 134 | const tracy = trace(@src()); | 134 | const tracy = trace(@src()); |
| 135 | defer tracy.end(); | 135 | defer tracy.end(); |
| 136 | 136 | ||
| 137 | var ordered_nodes = std.ArrayList(Node.Index).init(allocator); | 137 | var ordered_nodes = std.array_list.Managed(Node.Index).init(allocator); |
| 138 | defer ordered_nodes.deinit(); | 138 | defer ordered_nodes.deinit(); |
| 139 | try ordered_nodes.ensureTotalCapacityPrecise(self.nodes.items(.is_terminal).len); | 139 | try ordered_nodes.ensureTotalCapacityPrecise(self.nodes.items(.is_terminal).len); |
| 140 | 140 |
src/link/MachO/dyld_info/bind.zig+2-2| ... | @@ -34,7 +34,7 @@ pub const Bind = struct { | ... | @@ -34,7 +34,7 @@ pub const Bind = struct { |
| 34 | const gpa = macho_file.base.comp.gpa; | 34 | const gpa = macho_file.base.comp.gpa; |
| 35 | const cpu_arch = macho_file.getTarget().cpu.arch; | 35 | const cpu_arch = macho_file.getTarget().cpu.arch; |
| 36 | 36 | ||
| 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); |
| 38 | defer objects.deinit(); | 38 | defer objects.deinit(); |
| 39 | objects.appendSliceAssumeCapacity(macho_file.objects.items); | 39 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
| 40 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); | 40 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); |
| ... | @@ -286,7 +286,7 @@ pub const WeakBind = struct { | ... | @@ -286,7 +286,7 @@ pub const WeakBind = struct { |
| 286 | const gpa = macho_file.base.comp.gpa; | 286 | const gpa = macho_file.base.comp.gpa; |
| 287 | const cpu_arch = macho_file.getTarget().cpu.arch; | 287 | const cpu_arch = macho_file.getTarget().cpu.arch; |
| 288 | 288 | ||
| 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); |
| 290 | defer objects.deinit(); | 290 | defer objects.deinit(); |
| 291 | objects.appendSliceAssumeCapacity(macho_file.objects.items); | 291 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
| 292 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); | 292 | 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 { | ... | @@ -275,7 +275,7 @@ pub fn calcSize(macho_file: *MachO) !u32 { |
| 275 | 275 | ||
| 276 | var offset: u32 = 0; | 276 | var offset: u32 = 0; |
| 277 | 277 | ||
| 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); |
| 279 | defer cies.deinit(); | 279 | defer cies.deinit(); |
| 280 | 280 | ||
| 281 | for (macho_file.objects.items) |index| { | 281 | 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 | ... | @@ -3,7 +3,7 @@ pub fn flushObject(macho_file: *MachO, comp: *Compilation, module_obj_path: ?Pat |
| 3 | const diags = &macho_file.base.comp.link_diags; | 3 | const diags = &macho_file.base.comp.link_diags; |
| 4 | 4 | ||
| 5 | // TODO: "positional arguments" is a CLI concept, not a linker concept. Delete this unnecessary array list. | 5 | // 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); |
| 7 | defer positionals.deinit(); | 7 | defer positionals.deinit(); |
| 8 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); | 8 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); |
| 9 | positionals.appendSliceAssumeCapacity(comp.link_inputs); | 9 | positionals.appendSliceAssumeCapacity(comp.link_inputs); |
| ... | @@ -81,7 +81,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? | ... | @@ -81,7 +81,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 81 | const gpa = comp.gpa; | 81 | const gpa = comp.gpa; |
| 82 | const diags = &macho_file.base.comp.link_diags; | 82 | const diags = &macho_file.base.comp.link_diags; |
| 83 | 83 | ||
| 84 | var positionals = std.ArrayList(link.Input).init(gpa); | 84 | var positionals = std.array_list.Managed(link.Input).init(gpa); |
| 85 | defer positionals.deinit(); | 85 | defer positionals.deinit(); |
| 86 | 86 | ||
| 87 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); | 87 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); |
| ... | @@ -143,7 +143,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? | ... | @@ -143,7 +143,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 143 | try zo.readFileContents(macho_file); | 143 | try zo.readFileContents(macho_file); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | var files = std.ArrayList(File.Index).init(gpa); | 146 | var files = std.array_list.Managed(File.Index).init(gpa); |
| 147 | defer files.deinit(); | 147 | defer files.deinit(); |
| 148 | try files.ensureTotalCapacityPrecise(macho_file.objects.items.len + 1); | 148 | try files.ensureTotalCapacityPrecise(macho_file.objects.items.len + 1); |
| 149 | if (macho_file.getZigObject()) |zo| files.appendAssumeCapacity(zo.index); | 149 | if (macho_file.getZigObject()) |zo| files.appendAssumeCapacity(zo.index); |
| ... | @@ -205,7 +205,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? | ... | @@ -205,7 +205,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 205 | state_log.debug("ar_symtab\n{f}\n", .{ar_symtab.fmt(macho_file)}); | 205 | state_log.debug("ar_symtab\n{f}\n", .{ar_symtab.fmt(macho_file)}); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | var buffer = std.ArrayList(u8).init(gpa); | 208 | var buffer = std.array_list.Managed(u8).init(gpa); |
| 209 | defer buffer.deinit(); | 209 | defer buffer.deinit(); |
| 210 | try buffer.ensureTotalCapacityPrecise(total_size); | 210 | try buffer.ensureTotalCapacityPrecise(total_size); |
| 211 | const writer = buffer.writer(); | 211 | const writer = buffer.writer(); |
| ... | @@ -417,7 +417,7 @@ fn calcSymtabSize(macho_file: *MachO) error{OutOfMemory}!void { | ... | @@ -417,7 +417,7 @@ fn calcSymtabSize(macho_file: *MachO) error{OutOfMemory}!void { |
| 417 | var nimports: u32 = 0; | 417 | var nimports: u32 = 0; |
| 418 | var strsize: u32 = 1; | 418 | var strsize: u32 = 1; |
| 419 | 419 | ||
| 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); |
| 421 | defer objects.deinit(); | 421 | defer objects.deinit(); |
| 422 | if (macho_file.getZigObject()) |zo| objects.appendAssumeCapacity(zo.index); | 422 | if (macho_file.getZigObject()) |zo| objects.appendAssumeCapacity(zo.index); |
| 423 | objects.appendSliceAssumeCapacity(macho_file.objects.items); | 423 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
src/link/SpirV/BinaryModule.zig+4-4| ... | @@ -280,7 +280,7 @@ pub const Parser = struct { | ... | @@ -280,7 +280,7 @@ pub const Parser = struct { |
| 280 | self: *Parser, | 280 | self: *Parser, |
| 281 | binary: BinaryModule, | 281 | binary: BinaryModule, |
| 282 | inst: Instruction, | 282 | inst: Instruction, |
| 283 | offsets: *std.ArrayList(u16), | 283 | offsets: *std.array_list.Managed(u16), |
| 284 | ) !void { | 284 | ) !void { |
| 285 | const index = self.opcode_table.get(mapSetAndOpcode(.core, @intFromEnum(inst.opcode))).?; | 285 | const index = self.opcode_table.get(mapSetAndOpcode(.core, @intFromEnum(inst.opcode))).?; |
| 286 | const operands = InstructionSet.core.instructions()[index].operands; | 286 | const operands = InstructionSet.core.instructions()[index].operands; |
| ... | @@ -333,7 +333,7 @@ pub const Parser = struct { | ... | @@ -333,7 +333,7 @@ pub const Parser = struct { |
| 333 | inst: Instruction, | 333 | inst: Instruction, |
| 334 | operands: []const spec.Operand, | 334 | operands: []const spec.Operand, |
| 335 | start_offset: usize, | 335 | start_offset: usize, |
| 336 | offsets: *std.ArrayList(u16), | 336 | offsets: *std.array_list.Managed(u16), |
| 337 | ) !usize { | 337 | ) !usize { |
| 338 | var offset = start_offset; | 338 | var offset = start_offset; |
| 339 | for (operands) |operand| { | 339 | for (operands) |operand| { |
| ... | @@ -348,7 +348,7 @@ pub const Parser = struct { | ... | @@ -348,7 +348,7 @@ pub const Parser = struct { |
| 348 | inst: Instruction, | 348 | inst: Instruction, |
| 349 | operand: spec.Operand, | 349 | operand: spec.Operand, |
| 350 | start_offset: usize, | 350 | start_offset: usize, |
| 351 | offsets: *std.ArrayList(u16), | 351 | offsets: *std.array_list.Managed(u16), |
| 352 | ) !usize { | 352 | ) !usize { |
| 353 | var offset = start_offset; | 353 | var offset = start_offset; |
| 354 | switch (operand.quantifier) { | 354 | switch (operand.quantifier) { |
| ... | @@ -371,7 +371,7 @@ pub const Parser = struct { | ... | @@ -371,7 +371,7 @@ pub const Parser = struct { |
| 371 | inst: Instruction, | 371 | inst: Instruction, |
| 372 | kind: spec.OperandKind, | 372 | kind: spec.OperandKind, |
| 373 | start_offset: usize, | 373 | start_offset: usize, |
| 374 | offsets: *std.ArrayList(u16), | 374 | offsets: *std.array_list.Managed(u16), |
| 375 | ) !usize { | 375 | ) !usize { |
| 376 | var offset = start_offset; | 376 | var offset = start_offset; |
| 377 | if (offset >= inst.operands.len) return error.InvalidPhysicalFormat; | 377 | if (offset >= inst.operands.len) return error.InvalidPhysicalFormat; |
src/link/SpirV/lower_invocation_globals.zig+4-4| ... | @@ -74,9 +74,9 @@ const ModuleInfo = struct { | ... | @@ -74,9 +74,9 @@ const ModuleInfo = struct { |
| 74 | param_types: []const ResultId, | 74 | param_types: []const ResultId, |
| 75 | }).init(arena); | 75 | }).init(arena); |
| 76 | var calls = std.AutoArrayHashMap(ResultId, void).init(arena); | 76 | 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); |
| 78 | var function_invocation_globals = std.AutoArrayHashMap(ResultId, void).init(arena); | 78 | 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); |
| 80 | var invocation_globals = std.AutoArrayHashMap(ResultId, InvocationGlobal).init(arena); | 80 | var invocation_globals = std.AutoArrayHashMap(ResultId, InvocationGlobal).init(arena); |
| 81 | 81 | ||
| 82 | var maybe_current_function: ?ResultId = null; | 82 | var maybe_current_function: ?ResultId = null; |
| ... | @@ -498,8 +498,8 @@ const ModuleBuilder = struct { | ... | @@ -498,8 +498,8 @@ const ModuleBuilder = struct { |
| 498 | binary: BinaryModule, | 498 | binary: BinaryModule, |
| 499 | info: ModuleInfo, | 499 | info: ModuleInfo, |
| 500 | ) !void { | 500 | ) !void { |
| 501 | var result_id_offsets = std.ArrayList(u16).init(self.arena); | 501 | var result_id_offsets = std.array_list.Managed(u16).init(self.arena); |
| 502 | var operands = std.ArrayList(u32).init(self.arena); | 502 | var operands = std.array_list.Managed(u32).init(self.arena); |
| 503 | 503 | ||
| 504 | var maybe_current_function: ?ResultId = null; | 504 | var maybe_current_function: ?ResultId = null; |
| 505 | var it = binary.iterateInstructionsFrom(binary.sections.functions); | 505 | 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 { | ... | @@ -1051,7 +1051,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 1051 | }, | 1051 | }, |
| 1052 | } | 1052 | } |
| 1053 | 1053 | ||
| 1054 | var debug_bytes = std.ArrayList(u8).init(gpa); | 1054 | var debug_bytes = std.array_list.Managed(u8).init(gpa); |
| 1055 | defer debug_bytes.deinit(); | 1055 | defer debug_bytes.deinit(); |
| 1056 | 1056 | ||
| 1057 | try emitProducerSection(gpa, binary_bytes); | 1057 | try emitProducerSection(gpa, binary_bytes); |
| ... | @@ -1396,7 +1396,7 @@ pub fn emitExpr(wasm: *const Wasm, binary_bytes: *std.ArrayListUnmanaged(u8), ex | ... | @@ -1396,7 +1396,7 @@ pub fn emitExpr(wasm: *const Wasm, binary_bytes: *std.ArrayListUnmanaged(u8), ex |
| 1396 | try binary_bytes.appendSlice(gpa, slice[0 .. slice.len + 1]); // +1 to include end opcode | 1396 | try binary_bytes.appendSlice(gpa, slice[0 .. slice.len + 1]); // +1 to include end opcode |
| 1397 | } | 1397 | } |
| 1398 | 1398 | ||
| 1399 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.ArrayList(u8)) !void { | 1399 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.array_list.Managed(u8)) !void { |
| 1400 | const gpa = wasm.base.comp.gpa; | 1400 | const gpa = wasm.base.comp.gpa; |
| 1401 | const writer = binary_bytes.writer(gpa); | 1401 | const writer = binary_bytes.writer(gpa); |
| 1402 | try leb.writeUleb128(writer, @intFromEnum(Wasm.SubsectionType.segment_info)); | 1402 | try leb.writeUleb128(writer, @intFromEnum(Wasm.SubsectionType.segment_info)); |
src/link/tapi.zig+1-1| ... | @@ -83,7 +83,7 @@ pub const Tbd = union(enum) { | ... | @@ -83,7 +83,7 @@ pub const Tbd = union(enum) { |
| 83 | 83 | ||
| 84 | /// Caller owns memory. | 84 | /// Caller owns memory. |
| 85 | pub fn targets(self: Tbd, gpa: Allocator) error{OutOfMemory}![]const []const u8 { | 85 | 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); |
| 87 | defer out.deinit(); | 87 | defer out.deinit(); |
| 88 | 88 | ||
| 89 | switch (self) { | 89 | switch (self) { |
src/link/tapi/Tokenizer.zig+1-1| ... | @@ -297,7 +297,7 @@ fn testExpected(source: []const u8, expected: []const Token.Id) !void { | ... | @@ -297,7 +297,7 @@ fn testExpected(source: []const u8, expected: []const Token.Id) !void { |
| 297 | .buffer = source, | 297 | .buffer = source, |
| 298 | }; | 298 | }; |
| 299 | 299 | ||
| 300 | var given = std.ArrayList(Token.Id).init(testing.allocator); | 300 | var given = std.array_list.Managed(Token.Id).init(testing.allocator); |
| 301 | defer given.deinit(); | 301 | defer given.deinit(); |
| 302 | 302 | ||
| 303 | while (true) { | 303 | while (true) { |
src/link/tapi/parse.zig+1-1| ... | @@ -231,7 +231,7 @@ pub const Tree = struct { | ... | @@ -231,7 +231,7 @@ pub const Tree = struct { |
| 231 | 231 | ||
| 232 | pub fn parse(self: *Tree, source: []const u8) !void { | 232 | pub fn parse(self: *Tree, source: []const u8) !void { |
| 233 | var tokenizer = Tokenizer{ .buffer = source }; | 233 | 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); |
| 235 | defer tokens.deinit(); | 235 | defer tokens.deinit(); |
| 236 | 236 | ||
| 237 | var line: usize = 0; | 237 | var line: usize = 0; |
src/link/tapi/yaml.zig+5-5| ... | @@ -172,7 +172,7 @@ pub const Value = union(enum) { | ... | @@ -172,7 +172,7 @@ pub const Value = union(enum) { |
| 172 | 172 | ||
| 173 | return Value{ .map = out_map }; | 173 | return Value{ .map = out_map }; |
| 174 | } else if (node.cast(Node.List)) |list| { | 174 | } 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); |
| 176 | try out_list.ensureUnusedCapacity(list.values.items.len); | 176 | try out_list.ensureUnusedCapacity(list.values.items.len); |
| 177 | 177 | ||
| 178 | for (list.values.items) |elem| { | 178 | for (list.values.items) |elem| { |
| ... | @@ -211,7 +211,7 @@ pub const Value = union(enum) { | ... | @@ -211,7 +211,7 @@ pub const Value = union(enum) { |
| 211 | .float => return Value{ .float = math.lossyCast(f64, input) }, | 211 | .float => return Value{ .float = math.lossyCast(f64, input) }, |
| 212 | 212 | ||
| 213 | .@"struct" => |info| if (info.is_tuple) { | 213 | .@"struct" => |info| if (info.is_tuple) { |
| 214 | var list = std.ArrayList(Value).init(arena); | 214 | var list = std.array_list.Managed(Value).init(arena); |
| 215 | errdefer list.deinit(); | 215 | errdefer list.deinit(); |
| 216 | try list.ensureTotalCapacityPrecise(info.fields.len); | 216 | try list.ensureTotalCapacityPrecise(info.fields.len); |
| 217 | 217 | ||
| ... | @@ -262,7 +262,7 @@ pub const Value = union(enum) { | ... | @@ -262,7 +262,7 @@ pub const Value = union(enum) { |
| 262 | return Value{ .string = try arena.dupe(u8, input) }; | 262 | return Value{ .string = try arena.dupe(u8, input) }; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | var list = std.ArrayList(Value).init(arena); | 265 | var list = std.array_list.Managed(Value).init(arena); |
| 266 | errdefer list.deinit(); | 266 | errdefer list.deinit(); |
| 267 | try list.ensureTotalCapacityPrecise(input.len); | 267 | try list.ensureTotalCapacityPrecise(input.len); |
| 268 | 268 | ||
| ... | @@ -298,7 +298,7 @@ pub const Value = union(enum) { | ... | @@ -298,7 +298,7 @@ pub const Value = union(enum) { |
| 298 | pub const Yaml = struct { | 298 | pub const Yaml = struct { |
| 299 | arena: ArenaAllocator, | 299 | arena: ArenaAllocator, |
| 300 | tree: ?Tree = null, | 300 | tree: ?Tree = null, |
| 301 | docs: std.ArrayList(Value), | 301 | docs: std.array_list.Managed(Value), |
| 302 | 302 | ||
| 303 | pub fn deinit(self: *Yaml) void { | 303 | pub fn deinit(self: *Yaml) void { |
| 304 | self.arena.deinit(); | 304 | self.arena.deinit(); |
| ... | @@ -311,7 +311,7 @@ pub const Yaml = struct { | ... | @@ -311,7 +311,7 @@ pub const Yaml = struct { |
| 311 | var tree = Tree.init(arena.allocator()); | 311 | var tree = Tree.init(arena.allocator()); |
| 312 | try tree.parse(source); | 312 | try tree.parse(source); |
| 313 | 313 | ||
| 314 | var docs = std.ArrayList(Value).init(arena.allocator()); | 314 | var docs = std.array_list.Managed(Value).init(arena.allocator()); |
| 315 | try docs.ensureTotalCapacityPrecise(tree.docs.items.len); | 315 | try docs.ensureTotalCapacityPrecise(tree.docs.items.len); |
| 316 | 316 | ||
| 317 | for (tree.docs.items) |node| { | 317 | for (tree.docs.items) |node| { |
src/link/tapi/yaml/test.zig+1-1| ... | @@ -407,7 +407,7 @@ test "duplicate map keys" { | ... | @@ -407,7 +407,7 @@ test "duplicate map keys" { |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | fn testStringify(expected: []const u8, input: anytype) !void { | 409 | fn 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); |
| 411 | defer output.deinit(); | 411 | defer output.deinit(); |
| 412 | 412 | ||
| 413 | try yaml_mod.stringify(testing.allocator, input, output.writer()); | 413 | try yaml_mod.stringify(testing.allocator, input, output.writer()); |
src/main.zig+18-19| ... | @@ -6,7 +6,6 @@ const fs = std.fs; | ... | @@ -6,7 +6,6 @@ const fs = std.fs; |
| 6 | const mem = std.mem; | 6 | const mem = std.mem; |
| 7 | const process = std.process; | 7 | const process = std.process; |
| 8 | const Allocator = mem.Allocator; | 8 | const Allocator = mem.Allocator; |
| 9 | const ArrayList = std.ArrayList; | ||
| 10 | const Ast = std.zig.Ast; | 9 | const Ast = std.zig.Ast; |
| 11 | const Color = std.zig.Color; | 10 | const Color = std.zig.Color; |
| 12 | const warn = std.log.warn; | 11 | const warn = std.log.warn; |
| ... | @@ -1876,8 +1875,8 @@ fn buildOutputType( | ... | @@ -1876,8 +1875,8 @@ fn buildOutputType( |
| 1876 | var c_out_mode: ?COutMode = null; | 1875 | var c_out_mode: ?COutMode = null; |
| 1877 | var out_path: ?[]const u8 = null; | 1876 | var out_path: ?[]const u8 = null; |
| 1878 | var is_shared_lib = false; | 1877 | var is_shared_lib = false; |
| 1879 | var preprocessor_args = std.ArrayList([]const u8).init(arena); | 1878 | var preprocessor_args = std.array_list.Managed([]const u8).init(arena); |
| 1880 | var linker_args = std.ArrayList([]const u8).init(arena); | 1879 | var linker_args = std.array_list.Managed([]const u8).init(arena); |
| 1881 | var it = ClangArgIterator.init(arena, all_args); | 1880 | var it = ClangArgIterator.init(arena, all_args); |
| 1882 | var emit_llvm = false; | 1881 | var emit_llvm = false; |
| 1883 | var needed = false; | 1882 | var needed = false; |
| ... | @@ -3136,16 +3135,16 @@ fn buildOutputType( | ... | @@ -3136,16 +3135,16 @@ fn buildOutputType( |
| 3136 | } | 3135 | } |
| 3137 | } | 3136 | } |
| 3138 | 3137 | ||
| 3139 | var resolved_frameworks = std.ArrayList(Compilation.Framework).init(arena); | 3138 | var resolved_frameworks = std.array_list.Managed(Compilation.Framework).init(arena); |
| 3140 | 3139 | ||
| 3141 | if (create_module.frameworks.keys().len > 0) { | 3140 | 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); |
| 3143 | defer test_path.deinit(); | 3142 | defer test_path.deinit(); |
| 3144 | 3143 | ||
| 3145 | var checked_paths = std.ArrayList(u8).init(gpa); | 3144 | var checked_paths = std.array_list.Managed(u8).init(gpa); |
| 3146 | defer checked_paths.deinit(); | 3145 | defer checked_paths.deinit(); |
| 3147 | 3146 | ||
| 3148 | var failed_frameworks = std.ArrayList(struct { | 3147 | var failed_frameworks = std.array_list.Managed(struct { |
| 3149 | name: []const u8, | 3148 | name: []const u8, |
| 3150 | checked_paths: []const u8, | 3149 | checked_paths: []const u8, |
| 3151 | }).init(arena); | 3150 | }).init(arena); |
| ... | @@ -3774,7 +3773,7 @@ fn createModule( | ... | @@ -3774,7 +3773,7 @@ fn createModule( |
| 3774 | try llvm_to_zig_name.put(llvm_name, feature.name); | 3773 | try llvm_to_zig_name.put(llvm_name, feature.name); |
| 3775 | } | 3774 | } |
| 3776 | 3775 | ||
| 3777 | var mcpu_buffer = std.ArrayList(u8).init(gpa); | 3776 | var mcpu_buffer = std.array_list.Managed(u8).init(gpa); |
| 3778 | defer mcpu_buffer.deinit(); | 3777 | defer mcpu_buffer.deinit(); |
| 3779 | 3778 | ||
| 3780 | try mcpu_buffer.appendSlice(cli_mod.target_mcpu orelse "baseline"); | 3779 | try mcpu_buffer.appendSlice(cli_mod.target_mcpu orelse "baseline"); |
| ... | @@ -4332,7 +4331,7 @@ fn runOrTest( | ... | @@ -4332,7 +4331,7 @@ fn runOrTest( |
| 4332 | }), | 4331 | }), |
| 4333 | }; | 4332 | }; |
| 4334 | 4333 | ||
| 4335 | var argv = std.ArrayList([]const u8).init(gpa); | 4334 | var argv = std.array_list.Managed([]const u8).init(gpa); |
| 4336 | defer argv.deinit(); | 4335 | defer argv.deinit(); |
| 4337 | 4336 | ||
| 4338 | if (test_exec_args.len == 0) { | 4337 | if (test_exec_args.len == 0) { |
| ... | @@ -4453,7 +4452,7 @@ fn runOrTestHotSwap( | ... | @@ -4453,7 +4452,7 @@ fn runOrTestHotSwap( |
| 4453 | }; | 4452 | }; |
| 4454 | defer gpa.free(exe_path); | 4453 | defer gpa.free(exe_path); |
| 4455 | 4454 | ||
| 4456 | var argv = std.ArrayList([]const u8).init(gpa); | 4455 | var argv = std.array_list.Managed([]const u8).init(gpa); |
| 4457 | defer argv.deinit(); | 4456 | defer argv.deinit(); |
| 4458 | 4457 | ||
| 4459 | if (test_exec_args.len == 0) { | 4458 | if (test_exec_args.len == 0) { |
| ... | @@ -4570,7 +4569,7 @@ fn cmdTranslateC( | ... | @@ -4570,7 +4569,7 @@ fn cmdTranslateC( |
| 4570 | break :digest .{ bin_digest, hex_digest }; | 4569 | break :digest .{ bin_digest, hex_digest }; |
| 4571 | } else digest: { | 4570 | } else digest: { |
| 4572 | if (fancy_output) |p| p.cache_hit = false; | 4571 | 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); |
| 4574 | switch (comp.config.c_frontend) { | 4573 | switch (comp.config.c_frontend) { |
| 4575 | .aro => {}, | 4574 | .aro => {}, |
| 4576 | .clang => { | 4575 | .clang => { |
| ... | @@ -4877,7 +4876,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -4877,7 +4876,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4877 | var override_global_cache_dir: ?[]const u8 = try EnvVar.ZIG_GLOBAL_CACHE_DIR.get(arena); | 4876 | var override_global_cache_dir: ?[]const u8 = try EnvVar.ZIG_GLOBAL_CACHE_DIR.get(arena); |
| 4878 | var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena); | 4877 | var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena); |
| 4879 | var override_build_runner: ?[]const u8 = try EnvVar.ZIG_BUILD_RUNNER.get(arena); | 4878 | 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); |
| 4881 | var reference_trace: ?u32 = null; | 4880 | var reference_trace: ?u32 = null; |
| 4882 | var debug_compile_errors = false; | 4881 | var debug_compile_errors = false; |
| 4883 | var verbose_link = (native_os != .wasi or builtin.link_libc) and | 4882 | 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 { | ... | @@ -5304,7 +5303,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5304 | 5303 | ||
| 5305 | if (fetch_only) return cleanExit(); | 5304 | if (fetch_only) return cleanExit(); |
| 5306 | 5305 | ||
| 5307 | var source_buf = std.ArrayList(u8).init(gpa); | 5306 | var source_buf = std.array_list.Managed(u8).init(gpa); |
| 5308 | defer source_buf.deinit(); | 5307 | defer source_buf.deinit(); |
| 5309 | try job_queue.createDependenciesSource(&source_buf); | 5308 | try job_queue.createDependenciesSource(&source_buf); |
| 5310 | const deps_mod = try createDependenciesModule( | 5309 | const deps_mod = try createDependenciesModule( |
| ... | @@ -5986,7 +5985,7 @@ pub const ClangArgIterator = struct { | ... | @@ -5986,7 +5985,7 @@ pub const ClangArgIterator = struct { |
| 5986 | // NOTE: The ArgIteratorResponseFile returns tokens from next() that are slices of an | 5985 | // NOTE: The ArgIteratorResponseFile returns tokens from next() that are slices of an |
| 5987 | // internal buffer. This internal buffer is arena allocated, so it is not cleaned up here. | 5986 | // internal buffer. This internal buffer is arena allocated, so it is not cleaned up here. |
| 5988 | 5987 | ||
| 5989 | var resp_arg_list = std.ArrayList([]const u8).init(arena); | 5988 | var resp_arg_list = std.array_list.Managed([]const u8).init(arena); |
| 5990 | defer resp_arg_list.deinit(); | 5989 | defer resp_arg_list.deinit(); |
| 5991 | { | 5990 | { |
| 5992 | while (self.arg_iterator_response_file.next()) |token| { | 5991 | while (self.arg_iterator_response_file.next()) |token| { |
| ... | @@ -6868,8 +6867,8 @@ const ClangSearchSanitizer = struct { | ... | @@ -6868,8 +6867,8 @@ const ClangSearchSanitizer = struct { |
| 6868 | }; | 6867 | }; |
| 6869 | 6868 | ||
| 6870 | fn accessFrameworkPath( | 6869 | fn accessFrameworkPath( |
| 6871 | test_path: *std.ArrayList(u8), | 6870 | test_path: *std.array_list.Managed(u8), |
| 6872 | checked_paths: *std.ArrayList(u8), | 6871 | checked_paths: *std.array_list.Managed(u8), |
| 6873 | framework_dir_path: []const u8, | 6872 | framework_dir_path: []const u8, |
| 6874 | framework_name: []const u8, | 6873 | framework_name: []const u8, |
| 6875 | ) !bool { | 6874 | ) !bool { |
| ... | @@ -7214,7 +7213,7 @@ fn createEmptyDependenciesModule( | ... | @@ -7214,7 +7213,7 @@ fn createEmptyDependenciesModule( |
| 7214 | dirs: Compilation.Directories, | 7213 | dirs: Compilation.Directories, |
| 7215 | global_options: Compilation.Config, | 7214 | global_options: Compilation.Config, |
| 7216 | ) !void { | 7215 | ) !void { |
| 7217 | var source = std.ArrayList(u8).init(arena); | 7216 | var source = std.array_list.Managed(u8).init(arena); |
| 7218 | try Package.Fetch.JobQueue.createEmptyDependenciesSource(&source); | 7217 | try Package.Fetch.JobQueue.createEmptyDependenciesSource(&source); |
| 7219 | _ = try createDependenciesModule( | 7218 | _ = try createDependenciesModule( |
| 7220 | arena, | 7219 | arena, |
| ... | @@ -7418,7 +7417,7 @@ fn loadManifest( | ... | @@ -7418,7 +7417,7 @@ fn loadManifest( |
| 7418 | const Templates = struct { | 7417 | const Templates = struct { |
| 7419 | zig_lib_directory: Cache.Directory, | 7418 | zig_lib_directory: Cache.Directory, |
| 7420 | dir: fs.Dir, | 7419 | dir: fs.Dir, |
| 7421 | buffer: std.ArrayList(u8), | 7420 | buffer: std.array_list.Managed(u8), |
| 7422 | 7421 | ||
| 7423 | fn deinit(templates: *Templates) void { | 7422 | fn deinit(templates: *Templates) void { |
| 7424 | templates.zig_lib_directory.handle.close(); | 7423 | templates.zig_lib_directory.handle.close(); |
| ... | @@ -7510,7 +7509,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator) Templates { | ... | @@ -7510,7 +7509,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator) Templates { |
| 7510 | return .{ | 7509 | return .{ |
| 7511 | .zig_lib_directory = zig_lib_directory, | 7510 | .zig_lib_directory = zig_lib_directory, |
| 7512 | .dir = template_dir, | 7511 | .dir = template_dir, |
| 7513 | .buffer = std.ArrayList(u8).init(gpa), | 7512 | .buffer = std.array_list.Managed(u8).init(gpa), |
| 7514 | }; | 7513 | }; |
| 7515 | } | 7514 | } |
| 7516 | 7515 |
src/translate_c.zig+13-13| ... | @@ -924,10 +924,10 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -924,10 +924,10 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 924 | break :blk Tag.opaque_literal.init(); | 924 | break :blk Tag.opaque_literal.init(); |
| 925 | }; | 925 | }; |
| 926 | 926 | ||
| 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); |
| 928 | defer fields.deinit(); | 928 | defer fields.deinit(); |
| 929 | 929 | ||
| 930 | var functions = std.ArrayList(Node).init(c.gpa); | 930 | var functions = std.array_list.Managed(Node).init(c.gpa); |
| 931 | defer functions.deinit(); | 931 | defer functions.deinit(); |
| 932 | 932 | ||
| 933 | const flexible_field = flexibleArrayField(c, record_def); | 933 | const flexible_field = flexibleArrayField(c, record_def); |
| ... | @@ -2606,7 +2606,7 @@ fn transInitListExprRecord( | ... | @@ -2606,7 +2606,7 @@ fn transInitListExprRecord( |
| 2606 | 2606 | ||
| 2607 | const ty_node = try transType(c, scope, ty, loc); | 2607 | const ty_node = try transType(c, scope, ty, loc); |
| 2608 | const init_count = expr.getNumInits(); | 2608 | 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); |
| 2610 | defer field_inits.deinit(); | 2610 | defer field_inits.deinit(); |
| 2611 | 2611 | ||
| 2612 | if (init_count == 0) { | 2612 | if (init_count == 0) { |
| ... | @@ -3116,7 +3116,7 @@ fn transSwitch( | ... | @@ -3116,7 +3116,7 @@ fn transSwitch( |
| 3116 | defer cond_scope.deinit(); | 3116 | defer cond_scope.deinit(); |
| 3117 | const switch_expr = try transExpr(c, &cond_scope.base, stmt.getCond(), .used); | 3117 | const switch_expr = try transExpr(c, &cond_scope.base, stmt.getCond(), .used); |
| 3118 | 3118 | ||
| 3119 | var cases = std.ArrayList(Node).init(c.gpa); | 3119 | var cases = std.array_list.Managed(Node).init(c.gpa); |
| 3120 | defer cases.deinit(); | 3120 | defer cases.deinit(); |
| 3121 | var has_default = false; | 3121 | var has_default = false; |
| 3122 | 3122 | ||
| ... | @@ -3130,7 +3130,7 @@ fn transSwitch( | ... | @@ -3130,7 +3130,7 @@ fn transSwitch( |
| 3130 | while (it != end_it) : (it += 1) { | 3130 | while (it != end_it) : (it += 1) { |
| 3131 | switch (it[0].getStmtClass()) { | 3131 | switch (it[0].getStmtClass()) { |
| 3132 | .CaseStmtClass => { | 3132 | .CaseStmtClass => { |
| 3133 | var items = std.ArrayList(Node).init(c.gpa); | 3133 | var items = std.array_list.Managed(Node).init(c.gpa); |
| 3134 | defer items.deinit(); | 3134 | defer items.deinit(); |
| 3135 | const sub = try transCaseStmt(c, base_scope, it[0], &items); | 3135 | const sub = try transCaseStmt(c, base_scope, it[0], &items); |
| 3136 | const res = try transSwitchProngStmt(c, base_scope, sub, it, end_it); | 3136 | const res = try transSwitchProngStmt(c, base_scope, sub, it, end_it); |
| ... | @@ -3185,7 +3185,7 @@ fn transSwitch( | ... | @@ -3185,7 +3185,7 @@ fn transSwitch( |
| 3185 | 3185 | ||
| 3186 | /// Collects all items for this case, returns the first statement after the labels. | 3186 | /// Collects all items for this case, returns the first statement after the labels. |
| 3187 | /// If items ends up empty, the prong should be translated as an else. | 3187 | /// If items ends up empty, the prong should be translated as an else. |
| 3188 | fn transCaseStmt(c: *Context, scope: *Scope, stmt: *const clang.Stmt, items: *std.ArrayList(Node)) TransError!*const clang.Stmt { | 3188 | fn transCaseStmt(c: *Context, scope: *Scope, stmt: *const clang.Stmt, items: *std.array_list.Managed(Node)) TransError!*const clang.Stmt { |
| 3189 | var sub = stmt; | 3189 | var sub = stmt; |
| 3190 | var seen_default = false; | 3190 | var seen_default = false; |
| 3191 | while (true) { | 3191 | while (true) { |
| ... | @@ -4716,7 +4716,7 @@ fn transCreateNodeNumber(c: *Context, num: anytype, num_kind: enum { int, float | ... | @@ -4716,7 +4716,7 @@ fn transCreateNodeNumber(c: *Context, num: anytype, num_kind: enum { int, float |
| 4716 | } | 4716 | } |
| 4717 | 4717 | ||
| 4718 | fn transCreateNodeMacroFn(c: *Context, name: []const u8, ref: Node, proto_alias: *ast.Payload.Func) !Node { | 4718 | fn 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); |
| 4720 | defer fn_params.deinit(); | 4720 | defer fn_params.deinit(); |
| 4721 | 4721 | ||
| 4722 | for (proto_alias.data.params) |param| { | 4722 | for (proto_alias.data.params) |param| { |
| ... | @@ -5115,7 +5115,7 @@ fn finishTransFnProto( | ... | @@ -5115,7 +5115,7 @@ fn finishTransFnProto( |
| 5115 | const scope = &c.global_scope.base; | 5115 | const scope = &c.global_scope.base; |
| 5116 | 5116 | ||
| 5117 | const param_count: usize = if (fn_proto_ty != null) fn_proto_ty.?.getNumParams() else 0; | 5117 | 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); |
| 5119 | defer fn_params.deinit(); | 5119 | defer fn_params.deinit(); |
| 5120 | 5120 | ||
| 5121 | var i: usize = 0; | 5121 | var i: usize = 0; |
| ... | @@ -5333,7 +5333,7 @@ fn transPreprocessorEntities(c: *Context, unit: *clang.ASTUnit) Error!void { | ... | @@ -5333,7 +5333,7 @@ fn transPreprocessorEntities(c: *Context, unit: *clang.ASTUnit) Error!void { |
| 5333 | // TODO if we see #undef, delete it from the table | 5333 | // TODO if we see #undef, delete it from the table |
| 5334 | var it = unit.getLocalPreprocessingEntities_begin(); | 5334 | var it = unit.getLocalPreprocessingEntities_begin(); |
| 5335 | const it_end = unit.getLocalPreprocessingEntities_end(); | 5335 | 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); |
| 5337 | defer tok_list.deinit(); | 5337 | defer tok_list.deinit(); |
| 5338 | const scope = c.global_scope; | 5338 | const scope = c.global_scope; |
| 5339 | 5339 | ||
| ... | @@ -5484,7 +5484,7 @@ fn transMacroFnDefine(c: *Context, m: *MacroCtx) ParseError!void { | ... | @@ -5484,7 +5484,7 @@ fn transMacroFnDefine(c: *Context, m: *MacroCtx) ParseError!void { |
| 5484 | 5484 | ||
| 5485 | try m.skip(c, .l_paren); | 5485 | try m.skip(c, .l_paren); |
| 5486 | 5486 | ||
| 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); |
| 5488 | defer fn_params.deinit(); | 5488 | defer fn_params.deinit(); |
| 5489 | 5489 | ||
| 5490 | while (true) { | 5490 | while (true) { |
| ... | @@ -6459,7 +6459,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ? | ... | @@ -6459,7 +6459,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ? |
| 6459 | m.i += 1; | 6459 | m.i += 1; |
| 6460 | node = try Tag.call.create(c.arena, .{ .lhs = node, .args = &[0]Node{} }); | 6460 | node = try Tag.call.create(c.arena, .{ .lhs = node, .args = &[0]Node{} }); |
| 6461 | } else { | 6461 | } else { |
| 6462 | var args = std.ArrayList(Node).init(c.gpa); | 6462 | var args = std.array_list.Managed(Node).init(c.gpa); |
| 6463 | defer args.deinit(); | 6463 | defer args.deinit(); |
| 6464 | while (true) { | 6464 | while (true) { |
| 6465 | const arg = try parseCCondExpr(c, m, scope); | 6465 | const arg = try parseCCondExpr(c, m, scope); |
| ... | @@ -6480,7 +6480,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ? | ... | @@ -6480,7 +6480,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ? |
| 6480 | .l_brace => { | 6480 | .l_brace => { |
| 6481 | // Check for designated field initializers | 6481 | // Check for designated field initializers |
| 6482 | if (m.peek().? == .period) { | 6482 | 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); |
| 6484 | defer init_vals.deinit(); | 6484 | defer init_vals.deinit(); |
| 6485 | 6485 | ||
| 6486 | while (true) { | 6486 | while (true) { |
| ... | @@ -6506,7 +6506,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ? | ... | @@ -6506,7 +6506,7 @@ fn parseCPostfixExprInner(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ? |
| 6506 | continue; | 6506 | continue; |
| 6507 | } | 6507 | } |
| 6508 | 6508 | ||
| 6509 | var init_vals = std.ArrayList(Node).init(c.gpa); | 6509 | var init_vals = std.array_list.Managed(Node).init(c.gpa); |
| 6510 | defer init_vals.deinit(); | 6510 | defer init_vals.deinit(); |
| 6511 | 6511 | ||
| 6512 | while (true) { | 6512 | while (true) { |
test/behavior/struct.zig+1-1| ... | @@ -1826,7 +1826,7 @@ test "assign to slice.len of global variable" { | ... | @@ -1826,7 +1826,7 @@ test "assign to slice.len of global variable" { |
| 1826 | 1826 | ||
| 1827 | const S = struct { | 1827 | const S = struct { |
| 1828 | const allocator = std.testing.allocator; | 1828 | const allocator = std.testing.allocator; |
| 1829 | var list = std.ArrayList(u32).init(allocator); | 1829 | var list = std.array_list.Managed(u32).init(allocator); |
| 1830 | }; | 1830 | }; |
| 1831 | 1831 | ||
| 1832 | S.list.items.len = 0; | 1832 | S.list.items.len = 0; |
test/behavior/var_args.zig+3-3| ... | @@ -200,14 +200,14 @@ test "variadic functions" { | ... | @@ -200,14 +200,14 @@ test "variadic functions" { |
| 200 | if (builtin.cpu.arch.isSPARC() and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23718 | 200 | if (builtin.cpu.arch.isSPARC() and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23718 |
| 201 | 201 | ||
| 202 | const S = struct { | 202 | 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 { |
| 204 | var ap = @cVaStart(); | 204 | var ap = @cVaStart(); |
| 205 | defer @cVaEnd(&ap); | 205 | defer @cVaEnd(&ap); |
| 206 | vprintf(list_ptr, format, &ap); | 206 | vprintf(list_ptr, format, &ap); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | fn vprintf( | 209 | fn vprintf( |
| 210 | list: *std.ArrayList(u8), | 210 | list: *std.array_list.Managed(u8), |
| 211 | format: [*:0]const u8, | 211 | format: [*:0]const u8, |
| 212 | ap: *std.builtin.VaList, | 212 | ap: *std.builtin.VaList, |
| 213 | ) callconv(.c) void { | 213 | ) callconv(.c) void { |
| ... | @@ -225,7 +225,7 @@ test "variadic functions" { | ... | @@ -225,7 +225,7 @@ test "variadic functions" { |
| 225 | } | 225 | } |
| 226 | }; | 226 | }; |
| 227 | 227 | ||
| 228 | var list = std.ArrayList(u8).init(std.testing.allocator); | 228 | var list = std.array_list.Managed(u8).init(std.testing.allocator); |
| 229 | defer list.deinit(); | 229 | defer list.deinit(); |
| 230 | S.printf(&list, "dsd", @as(c_int, 1), @as([*:0]const u8, "hello"), @as(c_int, 5)); | 230 | S.printf(&list, "dsd", @as(c_int, 1), @as([*:0]const u8, "hello"), @as(c_int, 5)); |
| 231 | try std.testing.expectEqualStrings("1hello5", list.items); | 231 | try std.testing.expectEqualStrings("1hello5", list.items); |
test/src/Cases.zig+28-27| ... | @@ -1,7 +1,15 @@ | ... | @@ -1,7 +1,15 @@ |
| 1 | const Cases = @This(); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const std = @import("std"); | ||
| 4 | const assert = std.debug.assert; | ||
| 5 | const Allocator = std.mem.Allocator; | ||
| 6 | const getExternalExecutor = std.zig.system.getExternalExecutor; | ||
| 7 | const ArrayList = std.ArrayList; | ||
| 8 | |||
| 1 | gpa: Allocator, | 9 | gpa: Allocator, |
| 2 | arena: Allocator, | 10 | arena: Allocator, |
| 3 | cases: std.ArrayList(Case), | 11 | cases: std.array_list.Managed(Case), |
| 4 | translate: std.ArrayList(Translate), | 12 | translate: std.array_list.Managed(Translate), |
| 5 | 13 | ||
| 6 | pub const IncrementalCase = struct { | 14 | pub const IncrementalCase = struct { |
| 7 | base_path: []const u8, | 15 | base_path: []const u8, |
| ... | @@ -40,7 +48,7 @@ pub const Case = struct { | ... | @@ -40,7 +48,7 @@ pub const Case = struct { |
| 40 | output_mode: std.builtin.OutputMode, | 48 | output_mode: std.builtin.OutputMode, |
| 41 | optimize_mode: std.builtin.OptimizeMode = .Debug, | 49 | optimize_mode: std.builtin.OptimizeMode = .Debug, |
| 42 | 50 | ||
| 43 | files: std.ArrayList(File), | 51 | files: std.array_list.Managed(File), |
| 44 | case: ?union(enum) { | 52 | case: ?union(enum) { |
| 45 | /// Check that it compiles with no errors. | 53 | /// Check that it compiles with no errors. |
| 46 | Compile: void, | 54 | Compile: void, |
| ... | @@ -77,7 +85,7 @@ pub const Case = struct { | ... | @@ -77,7 +85,7 @@ pub const Case = struct { |
| 77 | /// `lower_to_build_steps`. If null, file imports will assert. | 85 | /// `lower_to_build_steps`. If null, file imports will assert. |
| 78 | import_path: ?[]const u8 = null, | 86 | import_path: ?[]const u8 = null, |
| 79 | 87 | ||
| 80 | deps: std.ArrayList(DepModule), | 88 | deps: std.array_list.Managed(DepModule), |
| 81 | 89 | ||
| 82 | pub fn addSourceFile(case: *Case, name: []const u8, src: [:0]const u8) void { | 90 | pub fn addSourceFile(case: *Case, name: []const u8, src: [:0]const u8) void { |
| 83 | case.files.append(.{ .path = name, .src = src }) catch @panic("OOM"); | 91 | case.files.append(.{ .path = name, .src = src }) catch @panic("OOM"); |
| ... | @@ -148,7 +156,7 @@ pub fn addExe( | ... | @@ -148,7 +156,7 @@ pub fn addExe( |
| 148 | .files = .init(ctx.arena), | 156 | .files = .init(ctx.arena), |
| 149 | .case = null, | 157 | .case = null, |
| 150 | .output_mode = .Exe, | 158 | .output_mode = .Exe, |
| 151 | .deps = std.ArrayList(DepModule).init(ctx.arena), | 159 | .deps = std.array_list.Managed(DepModule).init(ctx.arena), |
| 152 | }) catch @panic("out of memory"); | 160 | }) catch @panic("out of memory"); |
| 153 | return &ctx.cases.items[ctx.cases.items.len - 1]; | 161 | return &ctx.cases.items[ctx.cases.items.len - 1]; |
| 154 | } | 162 | } |
| ... | @@ -167,7 +175,7 @@ pub fn exeFromCompiledC(ctx: *Cases, name: []const u8, target_query: std.Target. | ... | @@ -167,7 +175,7 @@ pub fn exeFromCompiledC(ctx: *Cases, name: []const u8, target_query: std.Target. |
| 167 | .files = .init(ctx.arena), | 175 | .files = .init(ctx.arena), |
| 168 | .case = null, | 176 | .case = null, |
| 169 | .output_mode = .Exe, | 177 | .output_mode = .Exe, |
| 170 | .deps = std.ArrayList(DepModule).init(ctx.arena), | 178 | .deps = std.array_list.Managed(DepModule).init(ctx.arena), |
| 171 | .link_libc = true, | 179 | .link_libc = true, |
| 172 | }) catch @panic("out of memory"); | 180 | }) catch @panic("out of memory"); |
| 173 | return &ctx.cases.items[ctx.cases.items.len - 1]; | 181 | 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 | ... | @@ -197,7 +205,7 @@ pub fn addObjLlvm(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarge |
| 197 | .files = .init(ctx.arena), | 205 | .files = .init(ctx.arena), |
| 198 | .case = null, | 206 | .case = null, |
| 199 | .output_mode = .Obj, | 207 | .output_mode = .Obj, |
| 200 | .deps = std.ArrayList(DepModule).init(ctx.arena), | 208 | .deps = std.array_list.Managed(DepModule).init(ctx.arena), |
| 201 | .backend = .llvm, | 209 | .backend = .llvm, |
| 202 | .emit_bin = can_emit_bin, | 210 | .emit_bin = can_emit_bin, |
| 203 | .emit_asm = can_emit_asm, | 211 | .emit_asm = can_emit_asm, |
| ... | @@ -216,7 +224,7 @@ pub fn addObj( | ... | @@ -216,7 +224,7 @@ pub fn addObj( |
| 216 | .files = .init(ctx.arena), | 224 | .files = .init(ctx.arena), |
| 217 | .case = null, | 225 | .case = null, |
| 218 | .output_mode = .Obj, | 226 | .output_mode = .Obj, |
| 219 | .deps = std.ArrayList(DepModule).init(ctx.arena), | 227 | .deps = std.array_list.Managed(DepModule).init(ctx.arena), |
| 220 | }) catch @panic("out of memory"); | 228 | }) catch @panic("out of memory"); |
| 221 | return &ctx.cases.items[ctx.cases.items.len - 1]; | 229 | return &ctx.cases.items[ctx.cases.items.len - 1]; |
| 222 | } | 230 | } |
| ... | @@ -233,7 +241,7 @@ pub fn addTest( | ... | @@ -233,7 +241,7 @@ pub fn addTest( |
| 233 | .case = null, | 241 | .case = null, |
| 234 | .output_mode = .Exe, | 242 | .output_mode = .Exe, |
| 235 | .is_test = true, | 243 | .is_test = true, |
| 236 | .deps = std.ArrayList(DepModule).init(ctx.arena), | 244 | .deps = std.array_list.Managed(DepModule).init(ctx.arena), |
| 237 | }) catch @panic("out of memory"); | 245 | }) catch @panic("out of memory"); |
| 238 | return &ctx.cases.items[ctx.cases.items.len - 1]; | 246 | return &ctx.cases.items[ctx.cases.items.len - 1]; |
| 239 | } | 247 | } |
| ... | @@ -258,7 +266,7 @@ pub fn addC(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarget) *Ca | ... | @@ -258,7 +266,7 @@ pub fn addC(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarget) *Ca |
| 258 | .files = .init(ctx.arena), | 266 | .files = .init(ctx.arena), |
| 259 | .case = null, | 267 | .case = null, |
| 260 | .output_mode = .Obj, | 268 | .output_mode = .Obj, |
| 261 | .deps = std.ArrayList(DepModule).init(ctx.arena), | 269 | .deps = std.array_list.Managed(DepModule).init(ctx.arena), |
| 262 | }) catch @panic("out of memory"); | 270 | }) catch @panic("out of memory"); |
| 263 | return &ctx.cases.items[ctx.cases.items.len - 1]; | 271 | return &ctx.cases.items[ctx.cases.items.len - 1]; |
| 264 | } | 272 | } |
| ... | @@ -364,7 +372,7 @@ fn addFromDirInner( | ... | @@ -364,7 +372,7 @@ fn addFromDirInner( |
| 364 | b: *std.Build, | 372 | b: *std.Build, |
| 365 | ) !void { | 373 | ) !void { |
| 366 | var it = try iterable_dir.walk(ctx.arena); | 374 | var it = try iterable_dir.walk(ctx.arena); |
| 367 | var filenames: std.ArrayListUnmanaged([]const u8) = .empty; | 375 | var filenames: ArrayList([]const u8) = .empty; |
| 368 | 376 | ||
| 369 | while (try it.next()) |entry| { | 377 | while (try it.next()) |entry| { |
| 370 | if (entry.kind != .file) continue; | 378 | if (entry.kind != .file) continue; |
| ... | @@ -428,7 +436,7 @@ fn addFromDirInner( | ... | @@ -428,7 +436,7 @@ fn addFromDirInner( |
| 428 | continue; | 436 | continue; |
| 429 | } | 437 | } |
| 430 | 438 | ||
| 431 | var cases = std.ArrayList(usize).init(ctx.arena); | 439 | var cases = std.array_list.Managed(usize).init(ctx.arena); |
| 432 | 440 | ||
| 433 | // Cross-product to get all possible test combinations | 441 | // Cross-product to get all possible test combinations |
| 434 | for (targets) |target_query| { | 442 | for (targets) |target_query| { |
| ... | @@ -462,7 +470,7 @@ fn addFromDirInner( | ... | @@ -462,7 +470,7 @@ fn addFromDirInner( |
| 462 | .link_libc = link_libc, | 470 | .link_libc = link_libc, |
| 463 | .pic = pic, | 471 | .pic = pic, |
| 464 | .pie = pie, | 472 | .pie = pie, |
| 465 | .deps = std.ArrayList(DepModule).init(ctx.cases.allocator), | 473 | .deps = std.array_list.Managed(DepModule).init(ctx.cases.allocator), |
| 466 | .imports = imports, | 474 | .imports = imports, |
| 467 | .target = resolved_target, | 475 | .target = resolved_target, |
| 468 | }); | 476 | }); |
| ... | @@ -495,8 +503,8 @@ fn addFromDirInner( | ... | @@ -495,8 +503,8 @@ fn addFromDirInner( |
| 495 | pub fn init(gpa: Allocator, arena: Allocator) Cases { | 503 | pub fn init(gpa: Allocator, arena: Allocator) Cases { |
| 496 | return .{ | 504 | return .{ |
| 497 | .gpa = gpa, | 505 | .gpa = gpa, |
| 498 | .cases = std.ArrayList(Case).init(gpa), | 506 | .cases = std.array_list.Managed(Case).init(gpa), |
| 499 | .translate = std.ArrayList(Translate).init(gpa), | 507 | .translate = std.array_list.Managed(Translate).init(gpa), |
| 500 | .arena = arena, | 508 | .arena = arena, |
| 501 | }; | 509 | }; |
| 502 | } | 510 | } |
| ... | @@ -995,7 +1003,7 @@ const TestManifest = struct { | ... | @@ -995,7 +1003,7 @@ const TestManifest = struct { |
| 995 | key: []const u8, | 1003 | key: []const u8, |
| 996 | comptime T: type, | 1004 | comptime T: type, |
| 997 | ) ![]const T { | 1005 | ) ![]const T { |
| 998 | var out = std.ArrayList(T).init(allocator); | 1006 | var out = std.array_list.Managed(T).init(allocator); |
| 999 | defer out.deinit(); | 1007 | defer out.deinit(); |
| 1000 | var it = self.getConfigForKey(key, T); | 1008 | var it = self.getConfigForKey(key, T); |
| 1001 | while (try it.next()) |item| { | 1009 | while (try it.next()) |item| { |
| ... | @@ -1018,7 +1026,7 @@ const TestManifest = struct { | ... | @@ -1018,7 +1026,7 @@ const TestManifest = struct { |
| 1018 | } | 1026 | } |
| 1019 | 1027 | ||
| 1020 | fn trailingSplit(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const u8 { | 1028 | 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); |
| 1022 | defer out.deinit(); | 1030 | defer out.deinit(); |
| 1023 | var trailing_it = self.trailing(); | 1031 | var trailing_it = self.trailing(); |
| 1024 | while (trailing_it.next()) |line| { | 1032 | while (trailing_it.next()) |line| { |
| ... | @@ -1032,7 +1040,7 @@ const TestManifest = struct { | ... | @@ -1032,7 +1040,7 @@ const TestManifest = struct { |
| 1032 | } | 1040 | } |
| 1033 | 1041 | ||
| 1034 | fn trailingLines(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const []const u8 { | 1042 | 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); |
| 1036 | defer out.deinit(); | 1044 | defer out.deinit(); |
| 1037 | var it = self.trailing(); | 1045 | var it = self.trailing(); |
| 1038 | while (it.next()) |line| { | 1046 | while (it.next()) |line| { |
| ... | @@ -1043,9 +1051,9 @@ const TestManifest = struct { | ... | @@ -1043,9 +1051,9 @@ const TestManifest = struct { |
| 1043 | 1051 | ||
| 1044 | fn trailingLinesSplit(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const []const u8 { | 1052 | fn trailingLinesSplit(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const []const u8 { |
| 1045 | // Collect output lines split by empty lines | 1053 | // 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); |
| 1047 | defer out.deinit(); | 1055 | defer out.deinit(); |
| 1048 | var buf = std.ArrayList(u8).init(allocator); | 1056 | var buf = std.array_list.Managed(u8).init(allocator); |
| 1049 | defer buf.deinit(); | 1057 | defer buf.deinit(); |
| 1050 | var it = self.trailing(); | 1058 | var it = self.trailing(); |
| 1051 | while (it.next()) |line| { | 1059 | while (it.next()) |line| { |
| ... | @@ -1119,13 +1127,6 @@ const TestManifest = struct { | ... | @@ -1119,13 +1127,6 @@ const TestManifest = struct { |
| 1119 | } | 1127 | } |
| 1120 | }; | 1128 | }; |
| 1121 | 1129 | ||
| 1122 | const Cases = @This(); | ||
| 1123 | const builtin = @import("builtin"); | ||
| 1124 | const std = @import("std"); | ||
| 1125 | const assert = std.debug.assert; | ||
| 1126 | const Allocator = std.mem.Allocator; | ||
| 1127 | const getExternalExecutor = std.zig.system.getExternalExecutor; | ||
| 1128 | |||
| 1129 | fn resolveTargetQuery(query: std.Target.Query) std.Build.ResolvedTarget { | 1130 | fn resolveTargetQuery(query: std.Target.Query) std.Build.ResolvedTarget { |
| 1130 | return .{ | 1131 | return .{ |
| 1131 | .query = query, | 1132 | .query = query, |
test/src/CompareOutput.zig+2-3| ... | @@ -15,7 +15,7 @@ const Special = enum { | ... | @@ -15,7 +15,7 @@ const Special = enum { |
| 15 | 15 | ||
| 16 | const TestCase = struct { | 16 | const TestCase = struct { |
| 17 | name: []const u8, | 17 | name: []const u8, |
| 18 | sources: ArrayList(SourceFile), | 18 | sources: std.array_list.Managed(SourceFile), |
| 19 | expected_output: []const u8, | 19 | expected_output: []const u8, |
| 20 | link_libc: bool, | 20 | link_libc: bool, |
| 21 | special: Special, | 21 | special: Special, |
| ... | @@ -41,7 +41,7 @@ const TestCase = struct { | ... | @@ -41,7 +41,7 @@ const TestCase = struct { |
| 41 | pub fn createExtra(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8, special: Special) TestCase { | 41 | pub fn createExtra(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8, special: Special) TestCase { |
| 42 | var tc = TestCase{ | 42 | var tc = TestCase{ |
| 43 | .name = name, | 43 | .name = name, |
| 44 | .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator), | 44 | .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator), |
| 45 | .expected_output = expected_output, | 45 | .expected_output = expected_output, |
| 46 | .link_libc = false, | 46 | .link_libc = false, |
| 47 | .special = special, | 47 | .special = special, |
| ... | @@ -170,7 +170,6 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { | ... | @@ -170,7 +170,6 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 170 | 170 | ||
| 171 | const CompareOutput = @This(); | 171 | const CompareOutput = @This(); |
| 172 | const std = @import("std"); | 172 | const std = @import("std"); |
| 173 | const ArrayList = std.ArrayList; | ||
| 174 | const mem = std.mem; | 173 | const mem = std.mem; |
| 175 | const fs = std.fs; | 174 | const fs = std.fs; |
| 176 | const OptimizeMode = std.builtin.OptimizeMode; | 175 | const OptimizeMode = std.builtin.OptimizeMode; |
test/src/RunTranslatedC.zig+2-3| ... | @@ -6,7 +6,7 @@ target: std.Build.ResolvedTarget, | ... | @@ -6,7 +6,7 @@ target: std.Build.ResolvedTarget, |
| 6 | 6 | ||
| 7 | const TestCase = struct { | 7 | const TestCase = struct { |
| 8 | name: []const u8, | 8 | name: []const u8, |
| 9 | sources: ArrayList(SourceFile), | 9 | sources: std.array_list.Managed(SourceFile), |
| 10 | expected_stdout: []const u8, | 10 | expected_stdout: []const u8, |
| 11 | allow_warnings: bool, | 11 | allow_warnings: bool, |
| 12 | 12 | ||
| ... | @@ -34,7 +34,7 @@ pub fn create( | ... | @@ -34,7 +34,7 @@ pub fn create( |
| 34 | const tc = self.b.allocator.create(TestCase) catch unreachable; | 34 | const tc = self.b.allocator.create(TestCase) catch unreachable; |
| 35 | tc.* = TestCase{ | 35 | tc.* = TestCase{ |
| 36 | .name = name, | 36 | .name = name, |
| 37 | .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator), | 37 | .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator), |
| 38 | .expected_stdout = expected_stdout, | 38 | .expected_stdout = expected_stdout, |
| 39 | .allow_warnings = allow_warnings, | 39 | .allow_warnings = allow_warnings, |
| 40 | }; | 40 | }; |
| ... | @@ -103,7 +103,6 @@ pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void { | ... | @@ -103,7 +103,6 @@ pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void { |
| 103 | 103 | ||
| 104 | const RunTranslatedCContext = @This(); | 104 | const RunTranslatedCContext = @This(); |
| 105 | const std = @import("std"); | 105 | const std = @import("std"); |
| 106 | const ArrayList = std.ArrayList; | ||
| 107 | const fmt = std.fmt; | 106 | const fmt = std.fmt; |
| 108 | const mem = std.mem; | 107 | const mem = std.mem; |
| 109 | const fs = std.fs; | 108 | const fs = std.fs; |
test/src/TranslateC.zig+4-5| ... | @@ -6,8 +6,8 @@ test_target_filters: []const []const u8, | ... | @@ -6,8 +6,8 @@ test_target_filters: []const []const u8, |
| 6 | 6 | ||
| 7 | const TestCase = struct { | 7 | const TestCase = struct { |
| 8 | name: []const u8, | 8 | name: []const u8, |
| 9 | sources: ArrayList(SourceFile), | 9 | sources: std.array_list.Managed(SourceFile), |
| 10 | expected_lines: ArrayList([]const u8), | 10 | expected_lines: std.array_list.Managed([]const u8), |
| 11 | allow_warnings: bool, | 11 | allow_warnings: bool, |
| 12 | target: std.Target.Query = .{}, | 12 | target: std.Target.Query = .{}, |
| 13 | 13 | ||
| ... | @@ -39,8 +39,8 @@ pub fn create( | ... | @@ -39,8 +39,8 @@ pub fn create( |
| 39 | const tc = self.b.allocator.create(TestCase) catch unreachable; | 39 | const tc = self.b.allocator.create(TestCase) catch unreachable; |
| 40 | tc.* = TestCase{ | 40 | tc.* = TestCase{ |
| 41 | .name = name, | 41 | .name = name, |
| 42 | .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator), | 42 | .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator), |
| 43 | .expected_lines = ArrayList([]const u8).init(self.b.allocator), | 43 | .expected_lines = std.array_list.Managed([]const u8).init(self.b.allocator), |
| 44 | .allow_warnings = allow_warnings, | 44 | .allow_warnings = allow_warnings, |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| ... | @@ -125,7 +125,6 @@ pub fn addCase(self: *TranslateCContext, case: *const TestCase) void { | ... | @@ -125,7 +125,6 @@ pub fn addCase(self: *TranslateCContext, case: *const TestCase) void { |
| 125 | 125 | ||
| 126 | const TranslateCContext = @This(); | 126 | const TranslateCContext = @This(); |
| 127 | const std = @import("std"); | 127 | const std = @import("std"); |
| 128 | const ArrayList = std.ArrayList; | ||
| 129 | const fmt = std.fmt; | 128 | const fmt = std.fmt; |
| 130 | const mem = std.mem; | 129 | const mem = std.mem; |
| 131 | const fs = std.fs; | 130 | const fs = std.fs; |
test/src/check-stack-trace.zig+1-1| ... | @@ -24,7 +24,7 @@ pub fn main() !void { | ... | @@ -24,7 +24,7 @@ pub fn main() !void { |
| 24 | // - replace function name with symbolic string when optimize_mode != .Debug | 24 | // - replace function name with symbolic string when optimize_mode != .Debug |
| 25 | // - skip empty lines | 25 | // - skip empty lines |
| 26 | const got: []const u8 = got_result: { | 26 | const got: []const u8 = got_result: { |
| 27 | var buf = std.ArrayList(u8).init(arena); | 27 | var buf = std.array_list.Managed(u8).init(arena); |
| 28 | defer buf.deinit(); | 28 | defer buf.deinit(); |
| 29 | if (stderr.len != 0 and stderr[stderr.len - 1] == '\n') stderr = stderr[0 .. stderr.len - 1]; | 29 | if (stderr.len != 0 and stderr[stderr.len - 1] == '\n') stderr = stderr[0 .. stderr.len - 1]; |
| 30 | var it = mem.splitScalar(u8, stderr, '\n'); | 30 | var it = mem.splitScalar(u8, stderr, '\n'); |
test/standalone/windows_argv/fuzz.zig+2-2| ... | @@ -41,7 +41,7 @@ pub fn main() !void { | ... | @@ -41,7 +41,7 @@ pub fn main() !void { |
| 41 | std.debug.print("rand seed: {}\n", .{seed}); | 41 | std.debug.print("rand seed: {}\n", .{seed}); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | var cmd_line_w_buf = std.ArrayList(u16).init(allocator); | 44 | var cmd_line_w_buf = std.array_list.Managed(u16).init(allocator); |
| 45 | defer cmd_line_w_buf.deinit(); | 45 | defer cmd_line_w_buf.deinit(); |
| 46 | 46 | ||
| 47 | var i: u64 = 0; | 47 | var i: u64 = 0; |
| ... | @@ -84,7 +84,7 @@ fn randomCommandLineW(allocator: Allocator, rand: std.Random) ![:0]const u16 { | ... | @@ -84,7 +84,7 @@ fn randomCommandLineW(allocator: Allocator, rand: std.Random) ![:0]const u16 { |
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | const choices = rand.uintAtMostBiased(u16, 256); | 86 | 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); |
| 88 | errdefer buf.deinit(); | 88 | errdefer buf.deinit(); |
| 89 | 89 | ||
| 90 | for (0..choices) |_| { | 90 | for (0..choices) |_| { |
test/standalone/windows_argv/lib.zig+1-1| ... | @@ -17,7 +17,7 @@ fn testArgv(expected_args: []const [*:0]const u16) !void { | ... | @@ -17,7 +17,7 @@ fn testArgv(expected_args: []const [*:0]const u16) !void { |
| 17 | const allocator = arena_state.allocator(); | 17 | const allocator = arena_state.allocator(); |
| 18 | 18 | ||
| 19 | const args = try std.process.argsAlloc(allocator); | 19 | 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); |
| 21 | 21 | ||
| 22 | var eql = true; | 22 | var eql = true; |
| 23 | if (args.len != expected_args.len) eql = false; | 23 | 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 { | ... | @@ -42,7 +42,7 @@ pub fn main() anyerror!void { |
| 42 | try tmp.dir.setAsCwd(); | 42 | try tmp.dir.setAsCwd(); |
| 43 | defer tmp.parent_dir.setAsCwd() catch {}; | 43 | defer tmp.parent_dir.setAsCwd() catch {}; |
| 44 | 44 | ||
| 45 | var buf = try std.ArrayList(u8).initCapacity(allocator, 128); | 45 | var buf = try std.array_list.Managed(u8).initCapacity(allocator, 128); |
| 46 | defer buf.deinit(); | 46 | defer buf.deinit(); |
| 47 | try buf.appendSlice("@echo off\n"); | 47 | try buf.appendSlice("@echo off\n"); |
| 48 | try buf.append('"'); | 48 | try buf.append('"'); |
| ... | @@ -80,7 +80,7 @@ fn testExec(allocator: std.mem.Allocator, args: []const []const u8, env: ?*std.p | ... | @@ -80,7 +80,7 @@ fn testExec(allocator: std.mem.Allocator, args: []const []const u8, env: ?*std.p |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | fn testExecBat(allocator: std.mem.Allocator, bat: []const u8, args: []const []const u8, env: ?*std.process.EnvMap) !void { | 82 | fn 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); |
| 84 | defer argv.deinit(); | 84 | defer argv.deinit(); |
| 85 | argv.appendAssumeCapacity(bat); | 85 | argv.appendAssumeCapacity(bat); |
| 86 | argv.appendSliceAssumeCapacity(args); | 86 | argv.appendSliceAssumeCapacity(args); |
| ... | @@ -121,7 +121,7 @@ fn randomArg(allocator: Allocator, rand: std.Random) ![]const u8 { | ... | @@ -121,7 +121,7 @@ fn randomArg(allocator: Allocator, rand: std.Random) ![]const u8 { |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
| 123 | const choices = rand.uintAtMostBiased(u16, 256); | 123 | 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); |
| 125 | errdefer buf.deinit(); | 125 | errdefer buf.deinit(); |
| 126 | 126 | ||
| 127 | var last_codepoint: u21 = 0; | 127 | var last_codepoint: u21 = 0; |
test/standalone/windows_bat_args/test.zig+2-2| ... | @@ -16,7 +16,7 @@ pub fn main() anyerror!void { | ... | @@ -16,7 +16,7 @@ pub fn main() anyerror!void { |
| 16 | try tmp.dir.setAsCwd(); | 16 | try tmp.dir.setAsCwd(); |
| 17 | defer tmp.parent_dir.setAsCwd() catch {}; | 17 | defer tmp.parent_dir.setAsCwd() catch {}; |
| 18 | 18 | ||
| 19 | var buf = try std.ArrayList(u8).initCapacity(allocator, 128); | 19 | var buf = try std.array_list.Managed(u8).initCapacity(allocator, 128); |
| 20 | defer buf.deinit(); | 20 | defer buf.deinit(); |
| 21 | try buf.appendSlice("@echo off\n"); | 21 | try buf.appendSlice("@echo off\n"); |
| 22 | try buf.append('"'); | 22 | try buf.append('"'); |
| ... | @@ -127,7 +127,7 @@ fn testExec(allocator: std.mem.Allocator, args: []const []const u8, env: ?*std.p | ... | @@ -127,7 +127,7 @@ fn testExec(allocator: std.mem.Allocator, args: []const []const u8, env: ?*std.p |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | fn testExecBat(allocator: std.mem.Allocator, bat: []const u8, args: []const []const u8, env: ?*std.process.EnvMap) !void { | 129 | fn 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); |
| 131 | defer argv.deinit(); | 131 | defer argv.deinit(); |
| 132 | argv.appendAssumeCapacity(bat); | 132 | argv.appendAssumeCapacity(bat); |
| 133 | argv.appendSliceAssumeCapacity(args); | 133 | argv.appendSliceAssumeCapacity(args); |
tools/docgen.zig+5-5| ... | @@ -344,12 +344,12 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { | ... | @@ -344,12 +344,12 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { |
| 344 | var last_action: Action = .open; | 344 | var last_action: Action = .open; |
| 345 | var last_columns: ?u8 = null; | 345 | var last_columns: ?u8 = null; |
| 346 | 346 | ||
| 347 | var toc_buf = std.ArrayList(u8).init(allocator); | 347 | var toc_buf = std.array_list.Managed(u8).init(allocator); |
| 348 | defer toc_buf.deinit(); | 348 | defer toc_buf.deinit(); |
| 349 | 349 | ||
| 350 | var toc = toc_buf.writer(); | 350 | var toc = toc_buf.writer(); |
| 351 | 351 | ||
| 352 | var nodes = std.ArrayList(Node).init(allocator); | 352 | var nodes = std.array_list.Managed(Node).init(allocator); |
| 353 | defer nodes.deinit(); | 353 | defer nodes.deinit(); |
| 354 | 354 | ||
| 355 | try toc.writeByte('\n'); | 355 | try toc.writeByte('\n'); |
| ... | @@ -449,7 +449,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { | ... | @@ -449,7 +449,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { |
| 449 | last_action = .close; | 449 | last_action = .close; |
| 450 | } | 450 | } |
| 451 | } else if (mem.eql(u8, tag_name, "see_also")) { | 451 | } 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); |
| 453 | errdefer list.deinit(); | 453 | errdefer list.deinit(); |
| 454 | 454 | ||
| 455 | while (true) { | 455 | while (true) { |
| ... | @@ -599,7 +599,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { | ... | @@ -599,7 +599,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { |
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | fn urlize(allocator: Allocator, input: []const u8) ![]u8 { | 601 | fn 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); |
| 603 | defer buf.deinit(); | 603 | defer buf.deinit(); |
| 604 | 604 | ||
| 605 | const out = buf.writer(); | 605 | const out = buf.writer(); |
| ... | @@ -618,7 +618,7 @@ fn urlize(allocator: Allocator, input: []const u8) ![]u8 { | ... | @@ -618,7 +618,7 @@ fn urlize(allocator: Allocator, input: []const u8) ![]u8 { |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | fn escapeHtml(allocator: Allocator, input: []const u8) ![]u8 { | 620 | fn 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); |
| 622 | defer buf.deinit(); | 622 | defer buf.deinit(); |
| 623 | 623 | ||
| 624 | const out = buf.writer(); | 624 | const out = buf.writer(); |
tools/doctest.zig+20-20| ... | @@ -126,7 +126,7 @@ fn printOutput( | ... | @@ -126,7 +126,7 @@ fn printOutput( |
| 126 | const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch); | 126 | const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch); |
| 127 | const print = std.debug.print; | 127 | const print = std.debug.print; |
| 128 | 128 | ||
| 129 | var shell_buffer = std.ArrayList(u8).init(arena); | 129 | var shell_buffer = std.array_list.Managed(u8).init(arena); |
| 130 | defer shell_buffer.deinit(); | 130 | defer shell_buffer.deinit(); |
| 131 | var shell_out = shell_buffer.writer(); | 131 | var shell_out = shell_buffer.writer(); |
| 132 | 132 | ||
| ... | @@ -134,7 +134,7 @@ fn printOutput( | ... | @@ -134,7 +134,7 @@ fn printOutput( |
| 134 | 134 | ||
| 135 | switch (code.id) { | 135 | switch (code.id) { |
| 136 | .exe => |expected_outcome| code_block: { | 136 | .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); |
| 138 | defer build_args.deinit(); | 138 | defer build_args.deinit(); |
| 139 | try build_args.appendSlice(&[_][]const u8{ | 139 | try build_args.appendSlice(&[_][]const u8{ |
| 140 | zig_exe, "build-exe", | 140 | zig_exe, "build-exe", |
| ... | @@ -284,7 +284,7 @@ fn printOutput( | ... | @@ -284,7 +284,7 @@ fn printOutput( |
| 284 | try shell_out.writeAll("\n"); | 284 | try shell_out.writeAll("\n"); |
| 285 | }, | 285 | }, |
| 286 | .@"test" => { | 286 | .@"test" => { |
| 287 | var test_args = std.ArrayList([]const u8).init(arena); | 287 | var test_args = std.array_list.Managed([]const u8).init(arena); |
| 288 | defer test_args.deinit(); | 288 | defer test_args.deinit(); |
| 289 | 289 | ||
| 290 | try test_args.appendSlice(&[_][]const u8{ | 290 | try test_args.appendSlice(&[_][]const u8{ |
| ... | @@ -345,7 +345,7 @@ fn printOutput( | ... | @@ -345,7 +345,7 @@ fn printOutput( |
| 345 | try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout }); | 345 | try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout }); |
| 346 | }, | 346 | }, |
| 347 | .test_error => |error_match| { | 347 | .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); |
| 349 | defer test_args.deinit(); | 349 | defer test_args.deinit(); |
| 350 | 350 | ||
| 351 | try test_args.appendSlice(&[_][]const u8{ | 351 | try test_args.appendSlice(&[_][]const u8{ |
| ... | @@ -399,7 +399,7 @@ fn printOutput( | ... | @@ -399,7 +399,7 @@ fn printOutput( |
| 399 | try shell_out.print("\n{s}\n", .{colored_stderr}); | 399 | try shell_out.print("\n{s}\n", .{colored_stderr}); |
| 400 | }, | 400 | }, |
| 401 | .test_safety => |error_match| { | 401 | .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); |
| 403 | defer test_args.deinit(); | 403 | defer test_args.deinit(); |
| 404 | 404 | ||
| 405 | try test_args.appendSlice(&[_][]const u8{ | 405 | try test_args.appendSlice(&[_][]const u8{ |
| ... | @@ -461,7 +461,7 @@ fn printOutput( | ... | @@ -461,7 +461,7 @@ fn printOutput( |
| 461 | }, | 461 | }, |
| 462 | .obj => |maybe_error_match| { | 462 | .obj => |maybe_error_match| { |
| 463 | const name_plus_obj_ext = try std.fmt.allocPrint(arena, "{s}{s}", .{ code_name, obj_ext }); | 463 | 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); |
| 465 | defer build_args.deinit(); | 465 | defer build_args.deinit(); |
| 466 | 466 | ||
| 467 | try build_args.appendSlice(&[_][]const u8{ | 467 | try build_args.appendSlice(&[_][]const u8{ |
| ... | @@ -543,7 +543,7 @@ fn printOutput( | ... | @@ -543,7 +543,7 @@ fn printOutput( |
| 543 | .output_mode = .Lib, | 543 | .output_mode = .Lib, |
| 544 | }); | 544 | }); |
| 545 | 545 | ||
| 546 | var test_args = std.ArrayList([]const u8).init(arena); | 546 | var test_args = std.array_list.Managed([]const u8).init(arena); |
| 547 | defer test_args.deinit(); | 547 | defer test_args.deinit(); |
| 548 | 548 | ||
| 549 | try test_args.appendSlice(&[_][]const u8{ | 549 | try test_args.appendSlice(&[_][]const u8{ |
| ... | @@ -975,7 +975,7 @@ fn skipPrefix(line: []const u8) []const u8 { | ... | @@ -975,7 +975,7 @@ fn skipPrefix(line: []const u8) []const u8 { |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | fn escapeHtml(allocator: Allocator, input: []const u8) ![]u8 { | 977 | fn 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); |
| 979 | defer buf.deinit(); | 979 | defer buf.deinit(); |
| 980 | 980 | ||
| 981 | const out = buf.writer(); | 981 | const out = buf.writer(); |
| ... | @@ -1011,7 +1011,7 @@ fn termColor(allocator: Allocator, input: []const u8) ![]u8 { | ... | @@ -1011,7 +1011,7 @@ fn termColor(allocator: Allocator, input: []const u8) ![]u8 { |
| 1011 | const supported_sgr_colors = [_]u8{ 31, 32, 36 }; | 1011 | const supported_sgr_colors = [_]u8{ 31, 32, 36 }; |
| 1012 | const supported_sgr_numbers = [_]u8{ 0, 1, 2 }; | 1012 | const supported_sgr_numbers = [_]u8{ 0, 1, 2 }; |
| 1013 | 1013 | ||
| 1014 | var buf = std.ArrayList(u8).init(allocator); | 1014 | var buf = std.array_list.Managed(u8).init(allocator); |
| 1015 | defer buf.deinit(); | 1015 | defer buf.deinit(); |
| 1016 | 1016 | ||
| 1017 | var out = buf.writer(); | 1017 | var out = buf.writer(); |
| ... | @@ -1401,7 +1401,7 @@ test "printShell" { | ... | @@ -1401,7 +1401,7 @@ test "printShell" { |
| 1401 | \\</samp></pre></figure> | 1401 | \\</samp></pre></figure> |
| 1402 | ; | 1402 | ; |
| 1403 | 1403 | ||
| 1404 | var buffer = std.ArrayList(u8).init(test_allocator); | 1404 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1405 | defer buffer.deinit(); | 1405 | defer buffer.deinit(); |
| 1406 | 1406 | ||
| 1407 | try printShell(buffer.writer(), shell_out, false); | 1407 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1418,7 +1418,7 @@ test "printShell" { | ... | @@ -1418,7 +1418,7 @@ test "printShell" { |
| 1418 | \\</samp></pre></figure> | 1418 | \\</samp></pre></figure> |
| 1419 | ; | 1419 | ; |
| 1420 | 1420 | ||
| 1421 | var buffer = std.ArrayList(u8).init(test_allocator); | 1421 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1422 | defer buffer.deinit(); | 1422 | defer buffer.deinit(); |
| 1423 | 1423 | ||
| 1424 | try printShell(buffer.writer(), shell_out, false); | 1424 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1432,7 +1432,7 @@ test "printShell" { | ... | @@ -1432,7 +1432,7 @@ test "printShell" { |
| 1432 | \\</samp></pre></figure> | 1432 | \\</samp></pre></figure> |
| 1433 | ; | 1433 | ; |
| 1434 | 1434 | ||
| 1435 | var buffer = std.ArrayList(u8).init(test_allocator); | 1435 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1436 | defer buffer.deinit(); | 1436 | defer buffer.deinit(); |
| 1437 | 1437 | ||
| 1438 | try printShell(buffer.writer(), shell_out, false); | 1438 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1451,7 +1451,7 @@ test "printShell" { | ... | @@ -1451,7 +1451,7 @@ test "printShell" { |
| 1451 | \\</samp></pre></figure> | 1451 | \\</samp></pre></figure> |
| 1452 | ; | 1452 | ; |
| 1453 | 1453 | ||
| 1454 | var buffer = std.ArrayList(u8).init(test_allocator); | 1454 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1455 | defer buffer.deinit(); | 1455 | defer buffer.deinit(); |
| 1456 | 1456 | ||
| 1457 | try printShell(buffer.writer(), shell_out, false); | 1457 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1472,7 +1472,7 @@ test "printShell" { | ... | @@ -1472,7 +1472,7 @@ test "printShell" { |
| 1472 | \\</samp></pre></figure> | 1472 | \\</samp></pre></figure> |
| 1473 | ; | 1473 | ; |
| 1474 | 1474 | ||
| 1475 | var buffer = std.ArrayList(u8).init(test_allocator); | 1475 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1476 | defer buffer.deinit(); | 1476 | defer buffer.deinit(); |
| 1477 | 1477 | ||
| 1478 | try printShell(buffer.writer(), shell_out, false); | 1478 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1491,7 +1491,7 @@ test "printShell" { | ... | @@ -1491,7 +1491,7 @@ test "printShell" { |
| 1491 | \\</samp></pre></figure> | 1491 | \\</samp></pre></figure> |
| 1492 | ; | 1492 | ; |
| 1493 | 1493 | ||
| 1494 | var buffer = std.ArrayList(u8).init(test_allocator); | 1494 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1495 | defer buffer.deinit(); | 1495 | defer buffer.deinit(); |
| 1496 | 1496 | ||
| 1497 | try printShell(buffer.writer(), shell_out, false); | 1497 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1514,7 +1514,7 @@ test "printShell" { | ... | @@ -1514,7 +1514,7 @@ test "printShell" { |
| 1514 | \\</samp></pre></figure> | 1514 | \\</samp></pre></figure> |
| 1515 | ; | 1515 | ; |
| 1516 | 1516 | ||
| 1517 | var buffer = std.ArrayList(u8).init(test_allocator); | 1517 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1518 | defer buffer.deinit(); | 1518 | defer buffer.deinit(); |
| 1519 | 1519 | ||
| 1520 | try printShell(buffer.writer(), shell_out, false); | 1520 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1536,7 +1536,7 @@ test "printShell" { | ... | @@ -1536,7 +1536,7 @@ test "printShell" { |
| 1536 | \\</samp></pre></figure> | 1536 | \\</samp></pre></figure> |
| 1537 | ; | 1537 | ; |
| 1538 | 1538 | ||
| 1539 | var buffer = std.ArrayList(u8).init(test_allocator); | 1539 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1540 | defer buffer.deinit(); | 1540 | defer buffer.deinit(); |
| 1541 | 1541 | ||
| 1542 | try printShell(buffer.writer(), shell_out, false); | 1542 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1553,7 +1553,7 @@ test "printShell" { | ... | @@ -1553,7 +1553,7 @@ test "printShell" { |
| 1553 | \\</samp></pre></figure> | 1553 | \\</samp></pre></figure> |
| 1554 | ; | 1554 | ; |
| 1555 | 1555 | ||
| 1556 | var buffer = std.ArrayList(u8).init(test_allocator); | 1556 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1557 | defer buffer.deinit(); | 1557 | defer buffer.deinit(); |
| 1558 | 1558 | ||
| 1559 | try printShell(buffer.writer(), shell_out, false); | 1559 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1572,7 +1572,7 @@ test "printShell" { | ... | @@ -1572,7 +1572,7 @@ test "printShell" { |
| 1572 | \\</samp></pre></figure> | 1572 | \\</samp></pre></figure> |
| 1573 | ; | 1573 | ; |
| 1574 | 1574 | ||
| 1575 | var buffer = std.ArrayList(u8).init(test_allocator); | 1575 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1576 | defer buffer.deinit(); | 1576 | defer buffer.deinit(); |
| 1577 | 1577 | ||
| 1578 | try printShell(buffer.writer(), shell_out, false); | 1578 | try printShell(buffer.writer(), shell_out, false); |
| ... | @@ -1587,7 +1587,7 @@ test "printShell" { | ... | @@ -1587,7 +1587,7 @@ test "printShell" { |
| 1587 | \\</samp></pre></figure> | 1587 | \\</samp></pre></figure> |
| 1588 | ; | 1588 | ; |
| 1589 | 1589 | ||
| 1590 | var buffer = std.ArrayList(u8).init(test_allocator); | 1590 | var buffer = std.array_list.Managed(u8).init(test_allocator); |
| 1591 | defer buffer.deinit(); | 1591 | defer buffer.deinit(); |
| 1592 | 1592 | ||
| 1593 | try printShell(buffer.writer(), shell_out, false); | 1593 | try printShell(buffer.writer(), shell_out, false); |
tools/fetch_them_macos_headers.zig+2-2| ... | @@ -73,7 +73,7 @@ pub fn main() anyerror!void { | ... | @@ -73,7 +73,7 @@ pub fn main() anyerror!void { |
| 73 | 73 | ||
| 74 | const args = try std.process.argsAlloc(allocator); | 74 | const args = try std.process.argsAlloc(allocator); |
| 75 | 75 | ||
| 76 | var argv = std.ArrayList([]const u8).init(allocator); | 76 | var argv = std.array_list.Managed([]const u8).init(allocator); |
| 77 | var sysroot: ?[]const u8 = null; | 77 | var sysroot: ?[]const u8 = null; |
| 78 | 78 | ||
| 79 | var args_iter = ArgsIterator{ .args = args[1..] }; | 79 | var args_iter = ArgsIterator{ .args = args[1..] }; |
| ... | @@ -145,7 +145,7 @@ fn fetchTarget( | ... | @@ -145,7 +145,7 @@ fn fetchTarget( |
| 145 | ver.minor, | 145 | ver.minor, |
| 146 | }); | 146 | }); |
| 147 | 147 | ||
| 148 | var cc_argv = std.ArrayList([]const u8).init(arena); | 148 | var cc_argv = std.array_list.Managed([]const u8).init(arena); |
| 149 | try cc_argv.appendSlice(&[_][]const u8{ | 149 | try cc_argv.appendSlice(&[_][]const u8{ |
| 150 | "cc", | 150 | "cc", |
| 151 | "-arch", | 151 | "-arch", |
tools/gen_macos_headers_c.zig+3-3| ... | @@ -23,7 +23,7 @@ pub fn main() anyerror!void { | ... | @@ -23,7 +23,7 @@ pub fn main() anyerror!void { |
| 23 | const args = try std.process.argsAlloc(arena); | 23 | const args = try std.process.argsAlloc(arena); |
| 24 | if (args.len == 1) fatal("no command or option specified", .{}); | 24 | if (args.len == 1) fatal("no command or option specified", .{}); |
| 25 | 25 | ||
| 26 | var positionals = std.ArrayList([]const u8).init(arena); | 26 | var positionals = std.array_list.Managed([]const u8).init(arena); |
| 27 | 27 | ||
| 28 | for (args[1..]) |arg| { | 28 | for (args[1..]) |arg| { |
| 29 | if (std.mem.eql(u8, arg, "--help") or std.mem.eql(u8, arg, "-h")) { | 29 | if (std.mem.eql(u8, arg, "--help") or std.mem.eql(u8, arg, "-h")) { |
| ... | @@ -35,7 +35,7 @@ pub fn main() anyerror!void { | ... | @@ -35,7 +35,7 @@ pub fn main() anyerror!void { |
| 35 | 35 | ||
| 36 | var dir = try std.fs.cwd().openDir(positionals.items[0], .{ .no_follow = true }); | 36 | var dir = try std.fs.cwd().openDir(positionals.items[0], .{ .no_follow = true }); |
| 37 | defer dir.close(); | 37 | defer dir.close(); |
| 38 | var paths = std.ArrayList([]const u8).init(arena); | 38 | var paths = std.array_list.Managed([]const u8).init(arena); |
| 39 | try findHeaders(arena, dir, "", &paths); | 39 | try findHeaders(arena, dir, "", &paths); |
| 40 | 40 | ||
| 41 | const SortFn = struct { | 41 | const SortFn = struct { |
| ... | @@ -66,7 +66,7 @@ fn findHeaders( | ... | @@ -66,7 +66,7 @@ fn findHeaders( |
| 66 | arena: Allocator, | 66 | arena: Allocator, |
| 67 | dir: std.fs.Dir, | 67 | dir: std.fs.Dir, |
| 68 | prefix: []const u8, | 68 | prefix: []const u8, |
| 69 | paths: *std.ArrayList([]const u8), | 69 | paths: *std.array_list.Managed([]const u8), |
| 70 | ) anyerror!void { | 70 | ) anyerror!void { |
| 71 | var it = dir.iterate(); | 71 | var it = dir.iterate(); |
| 72 | while (try it.next()) |entry| { | 72 | while (try it.next()) |entry| { |
tools/gen_outline_atomics.zig+1-1| ... | @@ -37,7 +37,7 @@ pub fn main() !void { | ... | @@ -37,7 +37,7 @@ pub fn main() !void { |
| 37 | \\ | 37 | \\ |
| 38 | ); | 38 | ); |
| 39 | 39 | ||
| 40 | var footer = std.ArrayList(u8).init(arena); | 40 | var footer = std.array_list.Managed(u8).init(arena); |
| 41 | try footer.appendSlice("\ncomptime {\n"); | 41 | try footer.appendSlice("\ncomptime {\n"); |
| 42 | 42 | ||
| 43 | for ([_]N{ .one, .two, .four, .eight, .sixteen }) |n| { | 43 | for ([_]N{ .one, .two, .four, .eight, .sixteen }) |n| { |
tools/gen_spirv_spec.zig+5-7| ... | @@ -69,7 +69,7 @@ pub fn main() !void { | ... | @@ -69,7 +69,7 @@ pub fn main() !void { |
| 69 | const core_spec = try readRegistry(CoreRegistry, dir, "spirv.core.grammar.json"); | 69 | const core_spec = try readRegistry(CoreRegistry, dir, "spirv.core.grammar.json"); |
| 70 | std.mem.sortUnstable(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt); | 70 | std.mem.sortUnstable(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt); |
| 71 | 71 | ||
| 72 | var exts = std.ArrayList(Extension).init(allocator); | 72 | var exts = std.array_list.Managed(Extension).init(allocator); |
| 73 | 73 | ||
| 74 | var it = dir.iterate(); | 74 | var it = dir.iterate(); |
| 75 | while (try it.next()) |entry| { | 75 | while (try it.next()) |entry| { |
| ... | @@ -113,7 +113,7 @@ pub fn main() !void { | ... | @@ -113,7 +113,7 @@ pub fn main() !void { |
| 113 | _ = try std.fs.File.stdout().write(formatted_output); | 113 | _ = try std.fs.File.stdout().write(formatted_output); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | fn readExtRegistry(exts: *std.ArrayList(Extension), dir: std.fs.Dir, sub_path: []const u8) !void { | 116 | fn readExtRegistry(exts: *std.array_list.Managed(Extension), dir: std.fs.Dir, sub_path: []const u8) !void { |
| 117 | const filename = std.fs.path.basename(sub_path); | 117 | const filename = std.fs.path.basename(sub_path); |
| 118 | if (!std.mem.startsWith(u8, filename, "extinst.")) { | 118 | if (!std.mem.startsWith(u8, filename, "extinst.")) { |
| 119 | return; | 119 | return; |
| ... | @@ -296,8 +296,6 @@ fn render( | ... | @@ -296,8 +296,6 @@ fn render( |
| 296 | ); | 296 | ); |
| 297 | 297 | ||
| 298 | // Merge the operand kinds from all extensions together. | 298 | // 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); | ||
| 301 | var all_operand_kinds = OperandKindMap.init(allocator); | 299 | var all_operand_kinds = OperandKindMap.init(allocator); |
| 302 | for (registry.operand_kinds) |kind| { | 300 | for (registry.operand_kinds) |kind| { |
| 303 | try all_operand_kinds.putNoClobber(.{ "core", kind.kind }, kind); | 301 | try all_operand_kinds.putNoClobber(.{ "core", kind.kind }, kind); |
| ... | @@ -544,7 +542,7 @@ fn renderOpcodes( | ... | @@ -544,7 +542,7 @@ fn renderOpcodes( |
| 544 | var inst_map = std.AutoArrayHashMap(u32, usize).init(allocator); | 542 | var inst_map = std.AutoArrayHashMap(u32, usize).init(allocator); |
| 545 | try inst_map.ensureTotalCapacity(instructions.len); | 543 | try inst_map.ensureTotalCapacity(instructions.len); |
| 546 | 544 | ||
| 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); |
| 548 | try aliases.ensureTotalCapacity(instructions.len); | 546 | try aliases.ensureTotalCapacity(instructions.len); |
| 549 | 547 | ||
| 550 | for (instructions, 0..) |inst, i| { | 548 | for (instructions, 0..) |inst, i| { |
| ... | @@ -657,7 +655,7 @@ fn renderValueEnum( | ... | @@ -657,7 +655,7 @@ fn renderValueEnum( |
| 657 | var enum_map = std.AutoArrayHashMap(u32, usize).init(allocator); | 655 | var enum_map = std.AutoArrayHashMap(u32, usize).init(allocator); |
| 658 | try enum_map.ensureTotalCapacity(enumerants.len); | 656 | try enum_map.ensureTotalCapacity(enumerants.len); |
| 659 | 657 | ||
| 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); |
| 661 | try aliases.ensureTotalCapacity(enumerants.len); | 659 | try aliases.ensureTotalCapacity(enumerants.len); |
| 662 | 660 | ||
| 663 | for (enumerants, 0..) |enumerant, i| { | 661 | for (enumerants, 0..) |enumerant, i| { |
| ... | @@ -735,7 +733,7 @@ fn renderBitEnum( | ... | @@ -735,7 +733,7 @@ fn renderBitEnum( |
| 735 | var flags_by_bitpos = [_]?usize{null} ** 32; | 733 | var flags_by_bitpos = [_]?usize{null} ** 32; |
| 736 | const enumerants = enumeration.enumerants orelse return error.InvalidRegistry; | 734 | const enumerants = enumeration.enumerants orelse return error.InvalidRegistry; |
| 737 | 735 | ||
| 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); |
| 739 | try aliases.ensureTotalCapacity(enumerants.len); | 737 | try aliases.ensureTotalCapacity(enumerants.len); |
| 740 | 738 | ||
| 741 | for (enumerants, 0..) |enumerant, i| { | 739 | for (enumerants, 0..) |enumerant, i| { |
tools/generate_JSONTestSuite.zig+1-1| ... | @@ -19,7 +19,7 @@ pub fn main() !void { | ... | @@ -19,7 +19,7 @@ pub fn main() !void { |
| 19 | \\ | 19 | \\ |
| 20 | ); | 20 | ); |
| 21 | 21 | ||
| 22 | var names = std.ArrayList([]const u8).init(allocator); | 22 | var names = std.array_list.Managed([]const u8).init(allocator); |
| 23 | var cwd = try std.fs.cwd().openDir(".", .{ .iterate = true }); | 23 | var cwd = try std.fs.cwd().openDir(".", .{ .iterate = true }); |
| 24 | var it = cwd.iterate(); | 24 | var it = cwd.iterate(); |
| 25 | while (try it.next()) |entry| { | 25 | while (try it.next()) |entry| { |
tools/generate_linux_syscalls.zig+1-1| ... | @@ -591,7 +591,7 @@ fn generateSyscallsFromTable( | ... | @@ -591,7 +591,7 @@ fn generateSyscallsFromTable( |
| 591 | 591 | ||
| 592 | const table = try linux_dir.readFile(arch_info.file_path, buf); | 592 | const table = try linux_dir.readFile(arch_info.file_path, buf); |
| 593 | 593 | ||
| 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; |
| 595 | const optional_writer = if (optional_array_list) |_| optional_array_list.?.writer() else null; | 595 | const optional_writer = if (optional_array_list) |_| optional_array_list.?.writer() else null; |
| 596 | 596 | ||
| 597 | try writer.print("pub const {s} = enum(usize) {{\n", .{arch_info.enum_name}); | 597 | 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 | ... | @@ -319,13 +319,13 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | var mode: std.builtin.OptimizeMode = .Debug; | 321 | 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); |
| 323 | var target_str: ?[]const u8 = null; | 323 | var target_str: ?[]const u8 = null; |
| 324 | var link_libc = false; | 324 | var link_libc = false; |
| 325 | var link_mode: ?std.builtin.LinkMode = null; | 325 | var link_mode: ?std.builtin.LinkMode = null; |
| 326 | var disable_cache = false; | 326 | var disable_cache = false; |
| 327 | var verbose_cimport = false; | 327 | 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); |
| 329 | 329 | ||
| 330 | const source_token = while (true) { | 330 | const source_token = while (true) { |
| 331 | const content_tok = try eatToken(tokenizer, .content); | 331 | const content_tok = try eatToken(tokenizer, .content); |
| ... | @@ -437,7 +437,7 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype | ... | @@ -437,7 +437,7 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | fn urlize(allocator: Allocator, input: []const u8) ![]u8 { | 439 | fn 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); |
| 441 | defer buf.deinit(); | 441 | defer buf.deinit(); |
| 442 | 442 | ||
| 443 | const out = buf.writer(); | 443 | const out = buf.writer(); |
tools/process_headers.zig+3-3| ... | @@ -130,7 +130,7 @@ pub fn main() !void { | ... | @@ -130,7 +130,7 @@ pub fn main() !void { |
| 130 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 130 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 131 | const allocator = arena.allocator(); | 131 | const allocator = arena.allocator(); |
| 132 | const args = try std.process.argsAlloc(allocator); | 132 | 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); |
| 134 | var opt_out_dir: ?[]const u8 = null; | 134 | var opt_out_dir: ?[]const u8 = null; |
| 135 | var opt_abi: ?[]const u8 = null; | 135 | var opt_abi: ?[]const u8 = null; |
| 136 | 136 | ||
| ... | @@ -234,7 +234,7 @@ pub fn main() !void { | ... | @@ -234,7 +234,7 @@ pub fn main() !void { |
| 234 | .musl => &[_][]const u8{ search_path, libc_dir, "usr", "local", "musl", "include" }, | 234 | .musl => &[_][]const u8{ search_path, libc_dir, "usr", "local", "musl", "include" }, |
| 235 | }; | 235 | }; |
| 236 | const target_include_dir = try std.fs.path.join(allocator, sub_path); | 236 | 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); |
| 238 | try dir_stack.append(target_include_dir); | 238 | try dir_stack.append(target_include_dir); |
| 239 | 239 | ||
| 240 | while (dir_stack.pop()) |full_dir_name| { | 240 | while (dir_stack.pop()) |full_dir_name| { |
| ... | @@ -323,7 +323,7 @@ pub fn main() !void { | ... | @@ -323,7 +323,7 @@ pub fn main() !void { |
| 323 | // gets their header in a separate arch directory. | 323 | // gets their header in a separate arch directory. |
| 324 | var path_it = path_table.iterator(); | 324 | var path_it = path_table.iterator(); |
| 325 | while (path_it.next()) |path_kv| { | 325 | 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); |
| 327 | { | 327 | { |
| 328 | var hash_it = path_kv.value_ptr.*.iterator(); | 328 | var hash_it = path_kv.value_ptr.*.iterator(); |
| 329 | while (hash_it.next()) |hash_kv| { | 329 | while (hash_it.next()) |hash_kv| { |
tools/update-linux-headers.zig+3-3| ... | @@ -143,7 +143,7 @@ pub fn main() !void { | ... | @@ -143,7 +143,7 @@ pub fn main() !void { |
| 143 | var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 143 | var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 144 | const arena = arena_state.allocator(); | 144 | const arena = arena_state.allocator(); |
| 145 | const args = try std.process.argsAlloc(arena); | 145 | 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); |
| 147 | var opt_out_dir: ?[]const u8 = null; | 147 | var opt_out_dir: ?[]const u8 = null; |
| 148 | 148 | ||
| 149 | var arg_i: usize = 1; | 149 | var arg_i: usize = 1; |
| ... | @@ -186,7 +186,7 @@ pub fn main() !void { | ... | @@ -186,7 +186,7 @@ pub fn main() !void { |
| 186 | const target_include_dir = try std.fs.path.join(arena, &.{ | 186 | const target_include_dir = try std.fs.path.join(arena, &.{ |
| 187 | search_path, linux_target.name, "include", | 187 | search_path, linux_target.name, "include", |
| 188 | }); | 188 | }); |
| 189 | var dir_stack = std.ArrayList([]const u8).init(arena); | 189 | var dir_stack = std.array_list.Managed([]const u8).init(arena); |
| 190 | try dir_stack.append(target_include_dir); | 190 | try dir_stack.append(target_include_dir); |
| 191 | 191 | ||
| 192 | while (dir_stack.pop()) |full_dir_name| { | 192 | while (dir_stack.pop()) |full_dir_name| { |
| ... | @@ -261,7 +261,7 @@ pub fn main() !void { | ... | @@ -261,7 +261,7 @@ pub fn main() !void { |
| 261 | // gets their header in a separate arch directory. | 261 | // gets their header in a separate arch directory. |
| 262 | var path_it = path_table.iterator(); | 262 | var path_it = path_table.iterator(); |
| 263 | while (path_it.next()) |path_kv| { | 263 | 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); |
| 265 | { | 265 | { |
| 266 | var hash_it = path_kv.value_ptr.*.iterator(); | 266 | var hash_it = path_kv.value_ptr.*.iterator(); |
| 267 | while (hash_it.next()) |hash_kv| { | 267 | while (hash_it.next()) |hash_kv| { |
tools/update_clang_options.zig+1-1| ... | @@ -699,7 +699,7 @@ pub fn main() anyerror!void { | ... | @@ -699,7 +699,7 @@ pub fn main() anyerror!void { |
| 699 | defer parsed.deinit(); | 699 | defer parsed.deinit(); |
| 700 | const root_map = &parsed.value.object; | 700 | const root_map = &parsed.value.object; |
| 701 | 701 | ||
| 702 | var all_objects = std.ArrayList(*json.ObjectMap).init(allocator); | 702 | var all_objects = std.array_list.Managed(*json.ObjectMap).init(allocator); |
| 703 | { | 703 | { |
| 704 | var it = root_map.iterator(); | 704 | var it = root_map.iterator(); |
| 705 | it_map: while (it.next()) |kv| { | 705 | it_map: while (it.next()) |kv| { |
tools/update_cpu_features.zig+6-6| ... | @@ -1634,8 +1634,8 @@ fn processOneTarget(job: Job) void { | ... | @@ -1634,8 +1634,8 @@ fn processOneTarget(job: Job) void { |
| 1634 | defer progress_node.end(); | 1634 | defer progress_node.end(); |
| 1635 | 1635 | ||
| 1636 | var features_table = std.StringHashMap(Feature).init(arena); | 1636 | var features_table = std.StringHashMap(Feature).init(arena); |
| 1637 | var all_features = std.ArrayList(Feature).init(arena); | 1637 | var all_features = std.array_list.Managed(Feature).init(arena); |
| 1638 | var all_cpus = std.ArrayList(Cpu).init(arena); | 1638 | var all_cpus = std.array_list.Managed(Cpu).init(arena); |
| 1639 | 1639 | ||
| 1640 | if (target.llvm) |llvm| { | 1640 | if (target.llvm) |llvm| { |
| 1641 | const tblgen_progress = progress_node.start("running llvm-tblgen", 0); | 1641 | const tblgen_progress = progress_node.start("running llvm-tblgen", 0); |
| ... | @@ -1726,7 +1726,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -1726,7 +1726,7 @@ fn processOneTarget(job: Job) void { |
| 1726 | 1726 | ||
| 1727 | var zig_name = try llvmNameToZigName(arena, llvm_name); | 1727 | var zig_name = try llvmNameToZigName(arena, llvm_name); |
| 1728 | var desc = kv.value_ptr.object.get("Desc").?.string; | 1728 | 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); |
| 1730 | var omit = false; | 1730 | var omit = false; |
| 1731 | var flatten = false; | 1731 | var flatten = false; |
| 1732 | var omit_deps: []const []const u8 = &.{}; | 1732 | var omit_deps: []const []const u8 = &.{}; |
| ... | @@ -1810,7 +1810,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -1810,7 +1810,7 @@ fn processOneTarget(job: Job) void { |
| 1810 | if (omitted) continue; | 1810 | if (omitted) continue; |
| 1811 | 1811 | ||
| 1812 | var zig_name = try llvmNameToZigName(arena, llvm_name); | 1812 | 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); |
| 1814 | var omit_deps: []const []const u8 = &.{}; | 1814 | var omit_deps: []const []const u8 = &.{}; |
| 1815 | var extra_deps: []const []const u8 = &.{}; | 1815 | var extra_deps: []const []const u8 = &.{}; |
| 1816 | for (target.feature_overrides) |feature_override| { | 1816 | for (target.feature_overrides) |feature_override| { |
| ... | @@ -1979,7 +1979,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -1979,7 +1979,7 @@ fn processOneTarget(job: Job) void { |
| 1979 | try putDep(&deps_set, features_table, dep); | 1979 | try putDep(&deps_set, features_table, dep); |
| 1980 | } | 1980 | } |
| 1981 | try pruneFeatures(arena, features_table, &deps_set); | 1981 | 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); |
| 1983 | { | 1983 | { |
| 1984 | var it = deps_set.keyIterator(); | 1984 | var it = deps_set.keyIterator(); |
| 1985 | while (it.next()) |key| { | 1985 | while (it.next()) |key| { |
| ... | @@ -2024,7 +2024,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -2024,7 +2024,7 @@ fn processOneTarget(job: Job) void { |
| 2024 | try putDep(&deps_set, features_table, feature_zig_name); | 2024 | try putDep(&deps_set, features_table, feature_zig_name); |
| 2025 | } | 2025 | } |
| 2026 | try pruneFeatures(arena, features_table, &deps_set); | 2026 | 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); |
| 2028 | { | 2028 | { |
| 2029 | var it = deps_set.keyIterator(); | 2029 | var it = deps_set.keyIterator(); |
| 2030 | while (it.next()) |key| { | 2030 | while (it.next()) |key| { |
tools/update_crc_catalog.zig+1-1| ... | @@ -139,7 +139,7 @@ pub fn main() anyerror!void { | ... | @@ -139,7 +139,7 @@ pub fn main() anyerror!void { |
| 139 | _ = mem.replace(u8, snakecase, "-", "_", snakecase); | 139 | _ = mem.replace(u8, snakecase, "-", "_", snakecase); |
| 140 | _ = mem.replace(u8, snakecase, "/", "_", snakecase); | 140 | _ = mem.replace(u8, snakecase, "/", "_", snakecase); |
| 141 | 141 | ||
| 142 | var buf = try std.ArrayList(u8).initCapacity(arena, snakecase.len); | 142 | var buf = try std.array_list.Managed(u8).initCapacity(arena, snakecase.len); |
| 143 | defer buf.deinit(); | 143 | defer buf.deinit(); |
| 144 | 144 | ||
| 145 | var prev: u8 = 0; | 145 | var prev: u8 = 0; |