authorgravatar for hixuyuming@gmail.comhixuyuming <hixuyuming@gmail.com> 2026-05-01 17:04:01+08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-17 19:29:37+02:00
log093d28dfae39a64ef315c334e70ab3b72a698bb7
tree0ff27fcc70332abcb591d796aa5a6aa6afa573bd
parentd924f83bf3e1a5726d9eca1e9d501aece08107c5

Remove deprecated aliases of ArrayList and update usage sites.


11 files changed, 38 insertions(+), 44 deletions(-)

build.zig+4-4
......@@ -1119,11 +1119,11 @@ fn addCxxKnownPath(
11191119 const arena = b.graph.arena;
11201120
11211121 const path_padded = run: {
1122 var args = std.array_list.Managed([]const u8).init(arena);
1123 try args.append(ctx.cxx_compiler);
1122 var args: std.ArrayList([]const u8) = .empty;
1123 try args.append(arena, ctx.cxx_compiler);
11241124 var it = std.mem.tokenizeAny(u8, ctx.cxx_compiler_arg1, &std.ascii.whitespace);
1125 while (it.next()) |arg| try args.append(arg);
1126 try args.append(b.fmt("-print-file-name={s}", .{objname}));
1125 while (it.next()) |arg| try args.append(arena, arg);
1126 try args.append(arena, b.fmt("-print-file-name={s}", .{objname}));
11271127 break :run b.run(args.items);
11281128 };
11291129 var tokenizer = mem.tokenizeAny(u8, path_padded, "\r\n");
lib/build-web/fuzz.zig+1-1
......@@ -46,7 +46,7 @@ var coverage = Coverage.init;
4646/// Index of type `SourceLocationIndex`.
4747var coverage_source_locations: std.ArrayList(Coverage.SourceLocation) = .empty;
4848/// Contains the most recent coverage update message, unmodified.
49var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, .of(u64)) = .empty;
49var recent_coverage_update: std.array_list.Aligned(u8, .of(u64)) = .empty;
5050
5151fn updateCoverageSources(
5252 directories: []const Coverage.String,
lib/build-web/main.zig+1-1
......@@ -68,7 +68,7 @@ export fn alloc(n: usize) [*]u8 {
6868 return slice.ptr;
6969}
7070
71var message_buffer: std.ArrayListAlignedUnmanaged(u8, .of(u64)) = .empty;
71var message_buffer: std.array_list.Aligned(u8, .of(u64)) = .empty;
7272
7373/// Resizes the message buffer to be the correct length; returns the pointer to
7474/// the query string.
lib/compiler/aro/aro/Preprocessor.zig+1-1
......@@ -2699,7 +2699,7 @@ const PragmaLoc = struct { name_tok: TokenWithExpansionLocs, start: Tree.TokenIn
26992699
27002700fn addTokensFromExpandBuf(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs, tokenizer_nl: TokenWithExpansionLocs) !void {
27012701 const gpa = pp.comp.gpa;
2702 var pragma_locs: std.ArrayListUnmanaged(PragmaLoc) = .empty;
2702 var pragma_locs: std.ArrayList(PragmaLoc) = .empty;
27032703 defer pragma_locs.deinit(gpa);
27042704
27052705 try pp.ensureUnusedTokenCapacity(tokens.len);
lib/compiler/reduce.zig+4-4
......@@ -153,9 +153,9 @@ pub fn main(init: std.process.Init) !void {
153153 // result, restart the whole process, reparsing the AST and re-generating the list
154154 // of all possible transformations and shuffling it again.
155155
156 var transformations = std.array_list.Managed(Walk.Transformation).init(gpa);
157 defer transformations.deinit();
158 try Walk.findTransformations(arena, &tree, &transformations);
156 var transformations: std.ArrayList(Walk.Transformation) = .empty;
157 defer transformations.deinit(gpa);
158 try Walk.findTransformations(arena, gpa, &tree, &transformations);
159159 sortTransformations(transformations.items, rng.random());
160160
161161 fresh: while (transformations.items.len > 0) {
......@@ -238,7 +238,7 @@ pub fn main(init: std.process.Init) !void {
238238 tree.deinit(gpa);
239239 tree = new_tree;
240240
241 try Walk.findTransformations(arena, &tree, &transformations);
241 try Walk.findTransformations(arena, gpa, &tree, &transformations);
242242 sortTransformations(transformations.items, rng.random());
243243
244244 continue :fresh;
lib/compiler/reduce/Walk.zig+22-21
......@@ -5,7 +5,7 @@ const assert = std.debug.assert;
55const BuiltinFn = std.zig.BuiltinFn;
66
77ast: *const Ast,
8transformations: *std.array_list.Managed(Transformation),
8transformations: *std.ArrayList(Transformation),
99unreferenced_globals: std.array_hash_map.String(Ast.Node.Index),
1010in_scope_names: std.array_hash_map.String(u32),
1111replace_names: std.array_hash_map.String(u32),
......@@ -53,15 +53,16 @@ pub const Error = error{OutOfMemory};
5353/// The result will be priority shuffled.
5454pub fn findTransformations(
5555 arena: std.mem.Allocator,
56 gpa: std.mem.Allocator,
5657 ast: *const Ast,
57 transformations: *std.array_list.Managed(Transformation),
58 transformations: *std.ArrayList(Transformation),
5859) !void {
5960 transformations.clearRetainingCapacity();
6061
6162 var walk: Walk = .{
6263 .ast = ast,
6364 .transformations = transformations,
64 .gpa = transformations.allocator,
65 .gpa = gpa,
6566 .arena = arena,
6667 .unreferenced_globals = .empty,
6768 .in_scope_names = .empty,
......@@ -76,7 +77,7 @@ pub fn findTransformations(
7677 try walkMembers(&walk, walk.ast.rootDecls());
7778
7879 const unreferenced_globals = walk.unreferenced_globals.values();
79 try transformations.ensureUnusedCapacity(unreferenced_globals.len);
80 try transformations.ensureUnusedCapacity(gpa, unreferenced_globals.len);
8081 for (unreferenced_globals) |node| {
8182 transformations.appendAssumeCapacity(.{ .delete_node = node });
8283 }
......@@ -148,7 +149,7 @@ fn walkMember(w: *Walk, decl: Ast.Node.Index) Error!void {
148149 try walkExpression(w, fn_proto);
149150 if (!isFnBodyGutted(ast, body_node)) {
150151 w.replace_names.clearRetainingCapacity();
151 try w.transformations.append(.{ .gut_function = decl });
152 try w.transformations.append(w.gpa, .{ .gut_function = decl });
152153 try walkExpression(w, body_node);
153154 }
154155 },
......@@ -167,7 +168,7 @@ fn walkMember(w: *Walk, decl: Ast.Node.Index) Error!void {
167168 => try walkGlobalVarDecl(w, decl, ast.fullVarDecl(decl).?),
168169
169170 .test_decl => {
170 try w.transformations.append(.{ .delete_node = decl });
171 try w.transformations.append(w.gpa, .{ .delete_node = decl });
171172 try walkExpression(w, ast.nodeData(decl).opt_token_and_node[1]);
172173 },
173174
......@@ -175,12 +176,12 @@ fn walkMember(w: *Walk, decl: Ast.Node.Index) Error!void {
175176 .container_field_align,
176177 .container_field,
177178 => {
178 try w.transformations.append(.{ .delete_node = decl });
179 try w.transformations.append(w.gpa, .{ .delete_node = decl });
179180 try walkContainerField(w, ast.fullContainerField(decl).?);
180181 },
181182
182183 .@"comptime" => {
183 try w.transformations.append(.{ .delete_node = decl });
184 try w.transformations.append(w.gpa, .{ .delete_node = decl });
184185 try walkExpression(w, decl);
185186 },
186187
......@@ -536,7 +537,7 @@ fn walkGlobalVarDecl(w: *Walk, decl_node: Ast.Node.Index, var_decl: Ast.full.Var
536537
537538 if (var_decl.ast.init_node.unwrap()) |init_node| {
538539 if (!isUndefinedIdent(w.ast, init_node)) {
539 try w.transformations.append(.{ .replace_with_undef = init_node });
540 try w.transformations.append(w.gpa, .{ .replace_with_undef = init_node });
540541 }
541542 try walkExpression(w, init_node);
542543 }
......@@ -563,7 +564,7 @@ fn walkLocalVarDecl(w: *Walk, var_decl: Ast.full.VarDecl) Error!void {
563564
564565 if (var_decl.ast.init_node.unwrap()) |init_node| {
565566 if (!isUndefinedIdent(w.ast, init_node)) {
566 try w.transformations.append(.{ .replace_with_undef = init_node });
567 try w.transformations.append(w.gpa, .{ .replace_with_undef = init_node });
567568 }
568569 try walkExpression(w, init_node);
569570 }
......@@ -600,7 +601,7 @@ fn walkBlock(
600601 if (var_decl.ast.init_node != .none and
601602 isUndefinedIdent(w.ast, var_decl.ast.init_node.unwrap().?))
602603 {
603 try w.transformations.append(.{ .delete_var_decl = .{
604 try w.transformations.append(w.gpa, .{ .delete_var_decl = .{
604605 .var_decl_node = stmt,
605606 .references = .empty,
606607 } });
......@@ -618,7 +619,7 @@ fn walkBlock(
618619 .discard_identifier => {},
619620 // definitely try to remove `_ = undefined;` though.
620621 .discard_undefined, .trap_call, .other => {
621 try w.transformations.append(.{ .delete_node = stmt });
622 try w.transformations.append(w.gpa, .{ .delete_node = stmt });
622623 },
623624 }
624625 try walkExpression(w, stmt);
......@@ -720,7 +721,7 @@ fn walkBuiltinCall(
720721 if (std.mem.endsWith(u8, token_bytes, ".zig\"")) {
721722 const imported_string = std.zig.string_literal.parseAlloc(w.arena, token_bytes) catch
722723 unreachable;
723 try w.transformations.append(.{ .inline_imported_file = .{
724 try w.transformations.append(w.gpa, .{ .inline_imported_file = .{
724725 .builtin_call_node = call_node,
725726 .imported_string = imported_string,
726727 .in_scope_names = try std.array_hash_map.String(void).init(
......@@ -792,19 +793,19 @@ fn walkWhile(w: *Walk, node_index: Ast.Node.Index, while_node: Ast.full.While) E
792793 if (!isTrueIdent(w.ast, while_node.ast.cond_expr) and
793794 (while_node.ast.else_expr == .none or isEmptyBlock(w.ast, while_node.ast.else_expr.unwrap().?)))
794795 {
795 try w.transformations.ensureUnusedCapacity(1);
796 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
796797 w.transformations.appendAssumeCapacity(.{ .replace_with_true = while_node.ast.cond_expr });
797798 } else if (!isFalseIdent(w.ast, while_node.ast.cond_expr) and isEmptyBlock(w.ast, while_node.ast.then_expr)) {
798 try w.transformations.ensureUnusedCapacity(1);
799 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
799800 w.transformations.appendAssumeCapacity(.{ .replace_with_false = while_node.ast.cond_expr });
800801 } else if (isTrueIdent(w.ast, while_node.ast.cond_expr)) {
801 try w.transformations.ensureUnusedCapacity(1);
802 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
802803 w.transformations.appendAssumeCapacity(.{ .replace_node = .{
803804 .to_replace = node_index,
804805 .replacement = while_node.ast.then_expr,
805806 } });
806807 } else if (isFalseIdent(w.ast, while_node.ast.cond_expr)) {
807 try w.transformations.ensureUnusedCapacity(1);
808 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
808809 w.transformations.appendAssumeCapacity(.{ .replace_node = .{
809810 .to_replace = node_index,
810811 .replacement = while_node.ast.else_expr.unwrap().?,
......@@ -841,19 +842,19 @@ fn walkIf(w: *Walk, node_index: Ast.Node.Index, if_node: Ast.full.If) Error!void
841842 if (!isTrueIdent(w.ast, if_node.ast.cond_expr) and
842843 (if_node.ast.else_expr == .none or isEmptyBlock(w.ast, if_node.ast.else_expr.unwrap().?)))
843844 {
844 try w.transformations.ensureUnusedCapacity(1);
845 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
845846 w.transformations.appendAssumeCapacity(.{ .replace_with_true = if_node.ast.cond_expr });
846847 } else if (!isFalseIdent(w.ast, if_node.ast.cond_expr) and isEmptyBlock(w.ast, if_node.ast.then_expr)) {
847 try w.transformations.ensureUnusedCapacity(1);
848 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
848849 w.transformations.appendAssumeCapacity(.{ .replace_with_false = if_node.ast.cond_expr });
849850 } else if (isTrueIdent(w.ast, if_node.ast.cond_expr)) {
850 try w.transformations.ensureUnusedCapacity(1);
851 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
851852 w.transformations.appendAssumeCapacity(.{ .replace_node = .{
852853 .to_replace = node_index,
853854 .replacement = if_node.ast.then_expr,
854855 } });
855856 } else if (isFalseIdent(w.ast, if_node.ast.cond_expr)) {
856 try w.transformations.ensureUnusedCapacity(1);
857 try w.transformations.ensureUnusedCapacity(w.gpa, 1);
857858 w.transformations.appendAssumeCapacity(.{ .replace_node = .{
858859 .to_replace = node_index,
859860 .replacement = if_node.ast.else_expr.unwrap().?,
lib/docs/wasm/html_render.zig+1-1
......@@ -32,7 +32,7 @@ pub const Annotation = struct {
3232
3333pub fn fileSourceLineNumbersHtml(
3434 file_index: Walk.File.Index,
35 out: *std.ArrayListUnmanaged(u8),
35 out: *std.ArrayList(u8),
3636 root_node: Ast.Node.Index,
3737) !void {
3838 const ast = file_index.get_ast();
lib/std/crypto/argon2.zig+2-2
......@@ -12,7 +12,7 @@ const mem = std.mem;
1212const phc_format = pwhash.phc_format;
1313const pwhash = crypto.pwhash;
1414const Blake2b512 = blake2.Blake2b512;
15const Blocks = std.array_list.AlignedManaged([block_length]u64, .@"16");
15const Blocks = std.array_list.Aligned([block_length]u64, .@"16");
1616const H0 = [Blake2b512.digest_length + 8]u8;
1717
1818const EncodingError = crypto.errors.EncodingError;
......@@ -504,7 +504,7 @@ pub fn kdf(
504504 const memory = blockCount(params);
505505
506506 var blocks = try Blocks.initCapacity(allocator, memory);
507 defer blocks.deinit();
507 defer blocks.deinit(allocator);
508508
509509 const items = blocks.addManyAsSliceAssumeCapacity(memory);
510510
lib/std/std.zig-7
......@@ -54,13 +54,6 @@ pub fn ArrayList(comptime T: type) type {
5454}
5555pub const array_list = @import("array_list.zig");
5656
57/// Deprecated; use `array_list.Aligned`.
58pub const ArrayListAligned = array_list.Aligned;
59/// Deprecated; use `array_list.Aligned`.
60pub const ArrayListAlignedUnmanaged = array_list.Aligned;
61/// Deprecated; use `ArrayList`.
62pub const ArrayListUnmanaged = ArrayList;
63
6457pub const array_hash_map = @import("array_hash_map.zig");
6558pub const atomic = @import("atomic.zig");
6659pub const base64 = @import("base64.zig");
src/codegen/spork8/CodeGen.zig+1-1
......@@ -21,7 +21,7 @@ owner_nav: InternPool.Nav.Index,
2121func_index: InternPool.Index,
2222mir_instructions: std.MultiArrayList(Mir.Inst),
2323/// Contains extra data for MIR
24mir_extra: std.ArrayListUnmanaged(u32),
24mir_extra: std.ArrayList(u32),
2525
2626pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features {
2727 return comptime &.initMany(&.{
src/link/Spork8.zig+1-1
......@@ -24,7 +24,7 @@ base: link.File,
2424/// All MIR instructions for all Zcu functions.
2525mir_instructions: std.MultiArrayList(Mir.Inst) = .empty,
2626/// Corresponds to `mir_instructions`.
27mir_extra: std.ArrayListUnmanaged(u32) = .empty,
27mir_extra: std.ArrayList(u32) = .empty,
2828/// When the key is an enum type, this represents a `@tagName` function.
2929zcu_funcs: std.array_hash_map.Auto(InternPool.Index, ZcuFunc) = .empty,
3030