Commit 4ccc6f2b57

Andrew Kelley <andrew@ziglang.org>
2025-07-04 04:50:33
compiler: fix remaining build failures
1 parent 6489907
Changed files (6)
lib/std/fs/File.zig
@@ -1802,10 +1802,10 @@ pub const Writer = struct {
         }
         const copy_file_range = switch (native_os) {
             .freebsd => std.os.freebsd.copy_file_range,
-            .linux => if (std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 })) std.os.linux.wrapped.copy_file_range else void,
-            else => void,
+            .linux => if (std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 })) std.os.linux.wrapped.copy_file_range else {},
+            else => {},
         };
-        if (copy_file_range != void) cfr: {
+        if (@TypeOf(copy_file_range) != void) cfr: {
             if (w.copy_file_range_err != null) break :cfr;
             const buffered = limit.slice(file_reader.interface.buffer);
             if (io_w.end != 0 or buffered.len != 0) return drain(io_w, &.{buffered}, 1);
@@ -1814,7 +1814,7 @@ pub const Writer = struct {
             const off_in_ptr: ?*i64 = switch (file_reader.mode) {
                 .positional_reading, .streaming_reading => return error.Unimplemented,
                 .positional => p: {
-                    off_in = file_reader.pos;
+                    off_in = @intCast(file_reader.pos);
                     break :p &off_in;
                 },
                 .streaming => null,
@@ -1823,7 +1823,7 @@ pub const Writer = struct {
             const off_out_ptr: ?*i64 = switch (w.mode) {
                 .positional_reading, .streaming_reading => return error.Unimplemented,
                 .positional => p: {
-                    off_out = w.pos;
+                    off_out = @intCast(w.pos);
                     break :p &off_out;
                 },
                 .streaming => null,
src/libs/freebsd.zig
@@ -497,13 +497,13 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
             .lt => continue,
             .gt => {
                 // TODO Expose via compile error mechanism instead of log.
-                log.warn("invalid target FreeBSD libc version: {}", .{target_version});
+                log.warn("invalid target FreeBSD libc version: {f}", .{target_version});
                 return error.InvalidTargetLibCVersion;
             },
         }
     } else blk: {
         const latest_index = metadata.all_versions.len - 1;
-        log.warn("zig cannot build new FreeBSD libc version {}; providing instead {}", .{
+        log.warn("zig cannot build new FreeBSD libc version {f}; providing instead {f}", .{
             target_version, metadata.all_versions[latest_index],
         });
         break :blk latest_index;
src/libs/glibc.zig
@@ -736,13 +736,13 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
             .lt => continue,
             .gt => {
                 // TODO Expose via compile error mechanism instead of log.
-                log.warn("invalid target glibc version: {}", .{target_version});
+                log.warn("invalid target glibc version: {f}", .{target_version});
                 return error.InvalidTargetGLibCVersion;
             },
         }
     } else blk: {
         const latest_index = metadata.all_versions.len - 1;
-        log.warn("zig cannot build new glibc version {}; providing instead {}", .{
+        log.warn("zig cannot build new glibc version {f}; providing instead {f}", .{
             target_version, metadata.all_versions[latest_index],
         });
         break :blk latest_index;
src/libs/netbsd.zig
@@ -442,13 +442,13 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
             .lt => continue,
             .gt => {
                 // TODO Expose via compile error mechanism instead of log.
-                log.warn("invalid target NetBSD libc version: {}", .{target_version});
+                log.warn("invalid target NetBSD libc version: {f}", .{target_version});
                 return error.InvalidTargetLibCVersion;
             },
         }
     } else blk: {
         const latest_index = metadata.all_versions.len - 1;
-        log.warn("zig cannot build new NetBSD libc version {}; providing instead {}", .{
+        log.warn("zig cannot build new NetBSD libc version {f}; providing instead {f}", .{
             target_version, metadata.all_versions[latest_index],
         });
         break :blk latest_index;
src/link/Lld.zig
@@ -294,7 +294,7 @@ fn linkAsArchive(lld: *Lld, arena: Allocator) !void {
         break :p try comp.resolveEmitPathFlush(arena, .temp, base.zcu_object_basename.?);
     } else null;
 
-    log.debug("zcu_obj_path={?}", .{zcu_obj_path});
+    log.debug("zcu_obj_path={?f}", .{zcu_obj_path});
 
     const compiler_rt_path: ?Cache.Path = if (comp.compiler_rt_strat == .obj)
         comp.compiler_rt_obj.?.full_object_path
src/translate_c.zig
@@ -3327,7 +3327,7 @@ fn transConstantExpr(c: *Context, scope: *Scope, expr: *const clang.Expr, used:
             return maybeSuppressResult(c, used, as_node);
         },
         else => |kind| {
-            return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "unsupported constant expression kind '{f}'", .{kind});
+            return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "unsupported constant expression kind '{}'", .{kind});
         },
     }
 }
@@ -5884,9 +5884,9 @@ fn escapeUnprintables(ctx: *Context, m: *MacroCtx) ![]const u8 {
     if (std.unicode.utf8ValidateSlice(zigified)) return zigified;
 
     const formatter = std.ascii.hexEscape(zigified, .lower);
-    const encoded_size = @as(usize, @intCast(std.fmt.count("{fs}", .{formatter})));
+    const encoded_size: usize = @intCast(std.fmt.count("{f}", .{formatter}));
     const output = try ctx.arena.alloc(u8, encoded_size);
-    return std.fmt.bufPrint(output, "{fs}", .{formatter}) catch |err| switch (err) {
+    return std.fmt.bufPrint(output, "{f}", .{formatter}) catch |err| switch (err) {
         error.NoSpaceLeft => unreachable,
         else => |e| return e,
     };