aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-07-03 18:30:07 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-07-07 22:43:52 -0700
commit30c2921eb87c3157d52edd7d8ee874209a0f7538 (patch)
tree876d4864abe53e1b43afa87b6e0f61572179ff86 /src/Compilation.zig
parentd09b99d043cc097de569fb32938a423342490a83 (diff)
downloadzig-30c2921eb87c3157d52edd7d8ee874209a0f7538.tar.gz
zig-30c2921eb87c3157d52edd7d8ee874209a0f7538.zip
compiler: update a bunch of format strings
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 52e7772a73..9ee4f61df1 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -729,10 +729,10 @@ pub const Directories = struct {
};
if (std.mem.eql(u8, zig_lib.path orelse "", global_cache.path orelse "")) {
- fatal("zig lib directory '{}' cannot be equal to global cache directory '{}'", .{ zig_lib, global_cache });
+ fatal("zig lib directory '{f}' cannot be equal to global cache directory '{f}'", .{ zig_lib, global_cache });
}
if (std.mem.eql(u8, zig_lib.path orelse "", local_cache.path orelse "")) {
- fatal("zig lib directory '{}' cannot be equal to local cache directory '{}'", .{ zig_lib, local_cache });
+ fatal("zig lib directory '{f}' cannot be equal to local cache directory '{f}'", .{ zig_lib, local_cache });
}
return .{
@@ -2698,7 +2698,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void {
const prefix = man.cache.prefixes()[pp.prefix];
return comp.setMiscFailure(
.check_whole_cache,
- "failed to check cache: '{}{s}' {s} {s}",
+ "failed to check cache: '{f}{s}' {s} {s}",
.{ prefix, pp.sub_path, @tagName(man.diagnostic), @errorName(op.err) },
);
},
@@ -2915,7 +2915,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void {
renameTmpIntoCache(comp.dirs.local_cache, tmp_dir_sub_path, o_sub_path) catch |err| {
return comp.setMiscFailure(
.rename_results,
- "failed to rename compilation results ('{}{s}') into local cache ('{}{s}'): {s}",
+ "failed to rename compilation results ('{f}{s}') into local cache ('{f}{s}'): {s}",
.{
comp.dirs.local_cache, tmp_dir_sub_path,
comp.dirs.local_cache, o_sub_path,
@@ -2982,7 +2982,7 @@ pub fn appendFileSystemInput(comp: *Compilation, path: Compilation.Path) Allocat
break @intCast(i);
}
} else std.debug.panic(
- "missing prefix directory '{s}' ('{}') for '{s}'",
+ "missing prefix directory '{s}' ('{f}') for '{s}'",
.{ @tagName(path.root), want_prefix_dir, path.sub_path },
);
@@ -3321,7 +3321,7 @@ fn emitFromCObject(
emit_path.root_dir.handle,
emit_path.sub_path,
.{},
- ) catch |err| log.err("unable to copy '{}' to '{}': {s}", .{
+ ) catch |err| log.err("unable to copy '{f}' to '{f}': {s}", .{
src_path,
emit_path,
@errorName(err),
@@ -3669,7 +3669,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
.illegal_zig_import => try bundle.addString("this compiler implementation does not allow importing files from this directory"),
},
.src_loc = try bundle.addSourceLocation(.{
- .src_path = try bundle.printString("{}", .{file.path.fmt(comp)}),
+ .src_path = try bundle.printString("{f}", .{file.path.fmt(comp)}),
.span_start = start,
.span_main = start,
.span_end = @intCast(end),
@@ -3716,7 +3716,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
assert(!is_retryable);
// AstGen/ZoirGen succeeded with errors. Note that this may include AST errors.
_ = try file.getTree(zcu); // Tree must be loaded.
- const path = try std.fmt.allocPrint(gpa, "{}", .{file.path.fmt(comp)});
+ const path = try std.fmt.allocPrint(gpa, "{f}", .{file.path.fmt(comp)});
defer gpa.free(path);
if (file.zir != null) {
try bundle.addZirErrorMessages(file.zir.?, file.tree.?, file.source.?, path);
@@ -3771,9 +3771,8 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
if (!refs.contains(anal_unit)) continue;
}
- std.log.scoped(.zcu).debug("analysis error '{s}' reported from unit '{}'", .{
- error_msg.msg,
- zcu.fmtAnalUnit(anal_unit),
+ std.log.scoped(.zcu).debug("analysis error '{s}' reported from unit '{f}'", .{
+ error_msg.msg, zcu.fmtAnalUnit(anal_unit),
});
try addModuleErrorMsg(zcu, &bundle, error_msg.*, added_any_analysis_error);
@@ -3933,9 +3932,9 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
// This is a compiler bug.
const stderr = std.fs.File.stderr().deprecatedWriter();
try stderr.writeAll("referenced transitive analysis errors, but none actually emitted\n");
- try stderr.print("{} [transitive failure]\n", .{zcu.fmtAnalUnit(failed_unit)});
+ try stderr.print("{f} [transitive failure]\n", .{zcu.fmtAnalUnit(failed_unit)});
while (ref) |r| {
- try stderr.print("referenced by: {}{s}\n", .{
+ try stderr.print("referenced by: {f}{s}\n", .{
zcu.fmtAnalUnit(r.referencer),
if (zcu.transitive_failed_analysis.contains(r.referencer)) " [transitive failure]" else "",
});
@@ -4034,7 +4033,7 @@ pub fn addModuleErrorMsg(
const err_src_loc = module_err_msg.src_loc.upgrade(zcu);
const err_source = err_src_loc.file_scope.getSource(zcu) catch |err| {
try eb.addRootErrorMessage(.{
- .msg = try eb.printString("unable to load '{}': {s}", .{
+ .msg = try eb.printString("unable to load '{f}': {s}", .{
err_src_loc.file_scope.path.fmt(zcu.comp), @errorName(err),
}),
});
@@ -4097,7 +4096,7 @@ pub fn addModuleErrorMsg(
}
const src_loc = try eb.addSourceLocation(.{
- .src_path = try eb.printString("{}", .{err_src_loc.file_scope.path.fmt(zcu.comp)}),
+ .src_path = try eb.printString("{f}", .{err_src_loc.file_scope.path.fmt(zcu.comp)}),
.span_start = err_span.start,
.span_main = err_span.main,
.span_end = err_span.end,
@@ -4129,7 +4128,7 @@ pub fn addModuleErrorMsg(
const gop = try notes.getOrPutContext(gpa, .{
.msg = try eb.addString(module_note.msg),
.src_loc = try eb.addSourceLocation(.{
- .src_path = try eb.printString("{}", .{note_src_loc.file_scope.path.fmt(zcu.comp)}),
+ .src_path = try eb.printString("{f}", .{note_src_loc.file_scope.path.fmt(zcu.comp)}),
.span_start = span.start,
.span_main = span.main,
.span_end = span.end,
@@ -4174,7 +4173,7 @@ fn addReferenceTraceFrame(
try ref_traces.append(gpa, .{
.decl_name = try eb.printString("{s}{s}", .{ name, if (inlined) " [inlined]" else "" }),
.src_loc = try eb.addSourceLocation(.{
- .src_path = try eb.printString("{}", .{src.file_scope.path.fmt(zcu.comp)}),
+ .src_path = try eb.printString("{f}", .{src.file_scope.path.fmt(zcu.comp)}),
.span_start = span.start,
.span_main = span.main,
.span_end = span.end,
@@ -4835,7 +4834,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
var out_dir = docs_path.root_dir.handle.makeOpenPath(docs_path.sub_path, .{}) catch |err| {
return comp.lockAndSetMiscFailure(
.docs_copy,
- "unable to create output directory '{}': {s}",
+ "unable to create output directory '{f}': {s}",
.{ docs_path, @errorName(err) },
);
};
@@ -4855,7 +4854,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
var tar_file = out_dir.createFile("sources.tar", .{}) catch |err| {
return comp.lockAndSetMiscFailure(
.docs_copy,
- "unable to create '{}/sources.tar': {s}",
+ "unable to create '{f}/sources.tar': {s}",
.{ docs_path, @errorName(err) },
);
};
@@ -4884,7 +4883,7 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8,
const root_dir, const sub_path = root.openInfo(comp.dirs);
break :d root_dir.openDir(sub_path, .{ .iterate = true });
} catch |err| {
- return comp.lockAndSetMiscFailure(.docs_copy, "unable to open directory '{}': {s}", .{
+ return comp.lockAndSetMiscFailure(.docs_copy, "unable to open directory '{f}': {s}", .{
root.fmt(comp), @errorName(err),
});
};
@@ -4906,13 +4905,13 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8,
else => continue,
}
var file = mod_dir.openFile(entry.path, .{}) catch |err| {
- return comp.lockAndSetMiscFailure(.docs_copy, "unable to open '{}{s}': {s}", .{
+ return comp.lockAndSetMiscFailure(.docs_copy, "unable to open '{f}{s}': {s}", .{
root.fmt(comp), entry.path, @errorName(err),
});
};
defer file.close();
archiver.writeFile(entry.path, file) catch |err| {
- return comp.lockAndSetMiscFailure(.docs_copy, "unable to archive '{}{s}': {s}", .{
+ return comp.lockAndSetMiscFailure(.docs_copy, "unable to archive '{f}{s}': {s}", .{
root.fmt(comp), entry.path, @errorName(err),
});
};
@@ -5042,7 +5041,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye
var out_dir = docs_path.root_dir.handle.makeOpenPath(docs_path.sub_path, .{}) catch |err| {
return comp.lockAndSetMiscFailure(
.docs_copy,
- "unable to create output directory '{}': {s}",
+ "unable to create output directory '{f}': {s}",
.{ docs_path, @errorName(err) },
);
};
@@ -5054,10 +5053,8 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye
"main.wasm",
.{},
) catch |err| {
- return comp.lockAndSetMiscFailure(.docs_copy, "unable to copy '{}' to '{}': {s}", .{
- crt_file.full_object_path,
- docs_path,
- @errorName(err),
+ return comp.lockAndSetMiscFailure(.docs_copy, "unable to copy '{f}' to '{f}': {s}", .{
+ crt_file.full_object_path, docs_path, @errorName(err),
});
};
}
@@ -5130,7 +5127,7 @@ fn workerUpdateBuiltinFile(comp: *Compilation, file: *Zcu.File) void {
defer comp.mutex.unlock();
comp.setMiscFailure(
.write_builtin_zig,
- "unable to write '{}': {s}",
+ "unable to write '{f}': {s}",
.{ file.path.fmt(comp), @errorName(err) },
);
};
@@ -6033,7 +6030,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
// 24 is RT_MANIFEST
const resource_type = 24;
- const input = try std.fmt.allocPrint(arena, "{} {} \"{f}\"", .{
+ const input = try std.fmt.allocPrint(arena, "{d} {d} \"{f}\"", .{
resource_id, resource_type, fmtRcEscape(src_path),
});