authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-09-14 20:25:47-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-09-16 13:12:47-07:00
loge8882ffcf0d97cabfc974bdbc1c592f911832623
tree28125599834e248659e22beef92e21d7bf039519
parent514989908c897e9ecaf47402ea483dd573ba3b30

std.Build.Cache: fix compilation on 32-bit


4 files changed, 22 insertions(+), 9 deletions(-)

lib/compiler/Maker/Step.zig+3-2
...@@ -753,12 +753,13 @@ fn failWithCacheError(...@@ -753,12 +753,13 @@ fn failWithCacheError(
753 switch (err) {753 switch (err) {
754 error.CacheCheckFailed => switch (man.diagnostic) {754 error.CacheCheckFailed => switch (man.diagnostic) {
755 .none => unreachable,755 .none => unreachable,
756 .manifest_oversize => return s.fail(maker, "checking cache failed: {t}", .{man.diagnostic}),
756 .manifest_create, .manifest_stat, .manifest_read, .manifest_lock => |e| {757 .manifest_create, .manifest_stat, .manifest_read, .manifest_lock => |e| {
757 return s.fail(maker, "failed checking cache: {t} {t}", .{ man.diagnostic, e });758 return s.fail(maker, "checking cache failed: {t} {t}", .{ man.diagnostic, e });
758 },759 },
759 .file_open, .file_stat, .file_read, .file_hash => |op| {760 .file_open, .file_stat, .file_read, .file_hash => |op| {
760 const path = op.path(man);761 const path = op.path(man);
761 return s.fail(maker, "failed checking cache: {f} {t} {t}", .{ path, man.diagnostic, op.err });762 return s.fail(maker, "checking cache failed: {f} {t} {t}", .{ path, man.diagnostic, op.err });
762 },763 },
763 },764 },
764 error.OutOfMemory, error.Canceled => |e| return e,765 error.OutOfMemory, error.Canceled => |e| return e,
lib/std/Build/Cache.zig+4-1
...@@ -595,6 +595,7 @@ pub const Manifest = struct {...@@ -595,6 +595,7 @@ pub const Manifest = struct {
595 none,595 none,
596 manifest_create: Io.File.OpenError,596 manifest_create: Io.File.OpenError,
597 manifest_stat: Io.File.StatError,597 manifest_stat: Io.File.StatError,
598 manifest_oversize,
598 manifest_read: Io.File.ReadPositionalError,599 manifest_read: Io.File.ReadPositionalError,
599 manifest_lock: Io.File.LockError,600 manifest_lock: Io.File.LockError,
600 file_open: FileOp,601 file_open: FileOp,
...@@ -1011,10 +1012,12 @@ pub const Manifest = struct {...@@ -1011,10 +1012,12 @@ pub const Manifest = struct {
1011 const io = m.cache.io;1012 const io = m.cache.io;
1012 const manifest_file = m.manifest_file.?;1013 const manifest_file = m.manifest_file.?;
10131014
1014 const manifest_size = if (manifest_file.stat(io)) |stat| stat.size else |err| switch (err) {1015 const manifest_stat = manifest_file.stat(io) catch |err| switch (err) {
1015 error.Canceled => |e| return e,1016 error.Canceled => |e| return e,
1016 else => |e| return fail(&m.diagnostic, .{ .manifest_stat = e }),1017 else => |e| return fail(&m.diagnostic, .{ .manifest_stat = e }),
1017 };1018 };
1019 const manifest_size = std.math.cast(u32, manifest_stat.size) orelse
1020 return fail(&m.diagnostic, .manifest_oversize);
10181021
1019 if (manifest_size == 0 or manifest_size < m.contents.items.len) {1022 if (manifest_size == 0 or manifest_size < m.contents.items.len) {
1020 // Manifest file was never finalized.1023 // Manifest file was never finalized.
src/Compilation.zig+11-6
...@@ -2817,13 +2817,18 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE...@@ -2817,13 +2817,18 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE
2817 error.Canceled, error.OutOfMemory => |e| return e,2817 error.Canceled, error.OutOfMemory => |e| return e,
2818 error.CacheCheckFailed => switch (man.diagnostic) {2818 error.CacheCheckFailed => switch (man.diagnostic) {
2819 .none => unreachable,2819 .none => unreachable,
2820 .manifest_create, .manifest_stat, .manifest_read, .manifest_lock => |e| return comp.setMiscFailure(2820 .manifest_oversize => {
2821 .check_whole_cache,2821 return comp.setMiscFailure(.check_whole_cache, "checking cache failed: {t}", .{
2822 "failed to check cache: {t} {t}",2822 man.diagnostic,
2823 .{ man.diagnostic, e },2823 });
2824 ),2824 },
2825 .manifest_create, .manifest_stat, .manifest_read, .manifest_lock => |e| {
2826 return comp.setMiscFailure(.check_whole_cache, "checking cache failed: {t} {t}", .{
2827 man.diagnostic, e,
2828 });
2829 },
2825 .file_open, .file_stat, .file_read, .file_hash => |op| {2830 .file_open, .file_stat, .file_read, .file_hash => |op| {
2826 return comp.setMiscFailure(.check_whole_cache, "failed to check cache: {f} {t} {t}", .{2831 return comp.setMiscFailure(.check_whole_cache, "checking cache failed: {f} {t} {t}", .{
2827 op.path(&man), man.diagnostic, op.err,2832 op.path(&man), man.diagnostic, op.err,
2828 });2833 });
2829 },2834 },
src/libs/mingw.zig+4
...@@ -254,6 +254,10 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8, prog_node: std.P...@@ -254,6 +254,10 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8, prog_node: std.P
254 const status = man.check(prog_node) catch |err| switch (err) {254 const status = man.check(prog_node) catch |err| switch (err) {
255 error.CacheCheckFailed => switch (man.diagnostic) {255 error.CacheCheckFailed => switch (man.diagnostic) {
256 .none => unreachable,256 .none => unreachable,
257 .manifest_oversize => {
258 comp.setMiscFailure(.windows_import_lib, "checking cache failed: {t}", .{man.diagnostic});
259 return error.AlreadyReported;
260 },
257 .manifest_create, .manifest_stat, .manifest_read, .manifest_lock => |e| {261 .manifest_create, .manifest_stat, .manifest_read, .manifest_lock => |e| {
258 comp.setMiscFailure(.windows_import_lib, "checking cache failed: {t} {t}", .{ man.diagnostic, e });262 comp.setMiscFailure(.windows_import_lib, "checking cache failed: {t} {t}", .{ man.diagnostic, e });
259 return error.AlreadyReported;263 return error.AlreadyReported;