commit 0b768cd9ddc4dde512647cd60617db23ed6ec434 (tree)
parent 3ea77badf94d996740337f6ce6e6612178627dd1
Author: glowsquid <sachabarsayuracko@gmail.com>
Date: Wed, 22 Apr 2026 02:00:41 +0200
zig reduce: fix compilation (#31930)
fixes #31926
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31930
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Diffstat:
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/ci/aarch64-macos-release.sh b/ci/aarch64-macos-release.sh
@@ -55,6 +55,9 @@ stage3-release/bin/zig build test docs \
stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=ReleaseSafe
stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=Debug
+# Ensure that reduce compiles
+stage3-release/bin/zig reduce -h
+
# Ensure that stage3 and stage4 are byte-for-byte identical.
stage3-release/bin/zig build \
--maxrss ${ZSF_MAX_RSS:-0} \
diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh
@@ -77,6 +77,9 @@ stage3-release/bin/zig build test docs \
stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=ReleaseSafe
stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=Debug
+# Ensure that reduce compiles
+stage3-release/bin/zig reduce -h
+
# Ensure that stage3 and stage4 are byte-for-byte identical.
stage3-release/bin/zig build \
--prefix stage4-release \
diff --git a/ci/x86_64-windows-release.ps1 b/ci/x86_64-windows-release.ps1
@@ -61,6 +61,10 @@ CheckLastExitCode
# stage3-release\bin\zig.exe build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=Debug
# CheckLastExitCode
+# Ensure that reduce compiles
+stage3-release\bin\zig.exe build reduce -h
+CheckLastExitCode
+
# Ensure that stage3 and stage4 are byte-for-byte identical.
Write-Output "Build and compare stage4..."
stage3-release\bin\zig.exe build `
diff --git a/lib/compiler/reduce/Walk.zig b/lib/compiler/reduce/Walk.zig
@@ -6,9 +6,9 @@ const BuiltinFn = std.zig.BuiltinFn;
ast: *const Ast,
transformations: *std.array_list.Managed(Transformation),
-unreferenced_globals: std.StringArrayHashMapUnmanaged(Ast.Node.Index),
-in_scope_names: std.StringArrayHashMapUnmanaged(u32),
-replace_names: std.StringArrayHashMapUnmanaged(u32),
+unreferenced_globals: std.array_hash_map.String(Ast.Node.Index),
+in_scope_names: std.array_hash_map.String(u32),
+replace_names: std.array_hash_map.String(u32),
gpa: std.mem.Allocator,
arena: std.mem.Allocator,
@@ -63,9 +63,9 @@ pub fn findTransformations(
.transformations = transformations,
.gpa = transformations.allocator,
.arena = arena,
- .unreferenced_globals = .{},
- .in_scope_names = .{},
- .replace_names = .{},
+ .unreferenced_globals = .empty,
+ .in_scope_names = .empty,
+ .replace_names = .empty,
};
defer {
walk.unreferenced_globals.deinit(walk.gpa);
@@ -607,7 +607,7 @@ fn walkBlock(
{
try w.transformations.append(.{ .delete_var_decl = .{
.var_decl_node = stmt,
- .references = .{},
+ .references = .empty,
} });
const name_tok = var_decl.ast.mut_token + 1;
const name_bytes = ast.tokenSlice(name_tok);