diff --git a/doc/docgen.zig b/doc/docgen.zig index e995e2f324..7e0bedbb6c 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -215,9 +215,9 @@ const Tokenizer = struct { fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, args: anytype) anyerror { const loc = tokenizer.getTokenLocation(token); const args_prefix = .{ tokenizer.source_file_name, loc.line + 1, loc.column + 1 }; - print("{}:{}:{}: error: " ++ fmt ++ "\n", args_prefix ++ args); + print("{s}:{d}:{d}: error: " ++ fmt ++ "\n", args_prefix ++ args); if (loc.line_start <= loc.line_end) { - print("{}\n", .{tokenizer.buffer[loc.line_start..loc.line_end]}); + print("{s}\n", .{tokenizer.buffer[loc.line_start..loc.line_end]}); { var i: usize = 0; while (i < loc.column) : (i += 1) { @@ -238,7 +238,7 @@ fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, arg fn assertToken(tokenizer: *Tokenizer, token: Token, id: Token.Id) !void { if (token.id != id) { - return parseError(tokenizer, token, "expected {}, found {}", .{ @tagName(id), @tagName(token.id) }); + return parseError(tokenizer, token, "expected {s}, found {s}", .{ @tagName(id), @tagName(token.id) }); } } @@ -374,7 +374,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { return parseError( tokenizer, bracket_tok, - "unrecognized header_open param: {}", + "unrecognized header_open param: {s}", .{param}, ); } @@ -394,7 +394,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { }, }); if (try urls.fetchPut(urlized, tag_token)) |entry| { - parseError(tokenizer, tag_token, "duplicate header url: #{}", .{urlized}) catch {}; + parseError(tokenizer, tag_token, "duplicate header url: #{s}", .{urlized}) catch {}; parseError(tokenizer, entry.value, "other tag here", .{}) catch {}; return error.ParseError; } @@ -411,7 +411,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { } last_columns = columns; try toc.writeByteNTimes(' ', 4 + header_stack_size * 4); - try toc.print("
{}.zig
", .{code.name}); + try out.print("{s}.zig
", .{code.name}); } try out.writeAll("");
try tokenizeAndPrint(tokenizer, out, code.source_token);
try out.writeAll("");
- const name_plus_ext = try std.fmt.allocPrint(allocator, "{}.zig", .{code.name});
+ const name_plus_ext = try std.fmt.allocPrint(allocator, "{s}.zig", .{code.name});
const tmp_source_file_name = try fs.path.join(
allocator,
&[_][]const u8{ tmp_dir_name, name_plus_ext },
@@ -1057,7 +1057,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
switch (code.id) {
Code.Id.Exe => |expected_outcome| code_block: {
- const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ code.name, exe_ext });
+ const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, exe_ext });
var build_args = std.ArrayList([]const u8).init(allocator);
defer build_args.deinit();
try build_args.appendSlice(&[_][]const u8{
@@ -1066,7 +1066,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
"--color", "on",
"--enable-cache", tmp_source_file_name,
});
- try out.print("$ zig build-exe {}.zig", .{code.name});
+ try out.print("$ zig build-exe {s}.zig", .{code.name});
switch (code.mode) {
.Debug => {},
else => {
@@ -1075,7 +1075,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
},
}
for (code.link_objects) |link_object| {
- const name_with_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ link_object, obj_ext });
+ const name_with_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ link_object, obj_ext });
const full_path_object = try fs.path.join(
allocator,
&[_][]const u8{ tmp_dir_name, name_with_ext },
@@ -1093,7 +1093,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
if (code.target_str) |triple| {
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
if (!code.is_inline) {
- try out.print(" -target {}", .{triple});
+ try out.print(" -target {s}", .{triple});
}
}
if (expected_outcome == .BuildFail) {
@@ -1106,20 +1106,20 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
- print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
+ print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
dumpArgs(build_args.items);
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
}
},
else => {
- print("{}\nThe following command crashed:\n", .{result.stderr});
+ print("{s}\nThe following command crashed:\n", .{result.stderr});
dumpArgs(build_args.items);
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
- try out.print("\n{}
\n", .{colored_stderr});
+ try out.print("\n{s}\n", .{colored_stderr});
break :code_block;
}
const exec_result = exec(allocator, &env_map, build_args.items) catch
@@ -1138,7 +1138,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
}
const path_to_exe_dir = mem.trim(u8, exec_result.stdout, " \r\n");
- const path_to_exe_basename = try std.fmt.allocPrint(allocator, "{}{}", .{
+ const path_to_exe_basename = try std.fmt.allocPrint(allocator, "{s}{s}", .{
code.name,
target.exeFileExt(),
});
@@ -1160,7 +1160,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
- print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
+ print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
dumpArgs(run_args);
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
}
@@ -1179,7 +1179,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
const colored_stderr = try termColor(allocator, escaped_stderr);
const colored_stdout = try termColor(allocator, escaped_stdout);
- try out.print("\n$ ./{}\n{}{}", .{ code.name, colored_stdout, colored_stderr });
+ try out.print("\n$ ./{s}\n{s}{s}", .{ code.name, colored_stdout, colored_stderr });
if (exited_with_signal) {
try out.print("(process terminated by signal)", .{});
}
@@ -1190,7 +1190,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
defer test_args.deinit();
try test_args.appendSlice(&[_][]const u8{ zig_exe, "test", tmp_source_file_name });
- try out.print("$ zig test {}.zig", .{code.name});
+ try out.print("$ zig test {s}.zig", .{code.name});
switch (code.mode) {
.Debug => {},
else => {
@@ -1204,12 +1204,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
}
if (code.target_str) |triple| {
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
- try out.print(" -target {}", .{triple});
+ try out.print(" -target {s}", .{triple});
}
const result = exec(allocator, &env_map, test_args.items) catch return parseError(tokenizer, code.source_token, "test failed", .{});
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const escaped_stdout = try escapeHtml(allocator, result.stdout);
- try out.print("\n{}{}
\n", .{ escaped_stderr, escaped_stdout });
+ try out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout });
},
Code.Id.TestError => |error_match| {
var test_args = std.ArrayList([]const u8).init(allocator);
@@ -1222,7 +1222,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
"on",
tmp_source_file_name,
});
- try out.print("$ zig test {}.zig", .{code.name});
+ try out.print("$ zig test {s}.zig", .{code.name});
switch (code.mode) {
.Debug => {},
else => {
@@ -1239,24 +1239,24 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
- print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
+ print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
dumpArgs(test_args.items);
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
}
},
else => {
- print("{}\nThe following command crashed:\n", .{result.stderr});
+ print("{s}\nThe following command crashed:\n", .{result.stderr});
dumpArgs(test_args.items);
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
- print("{}\nExpected to find '{}' in stderr\n", .{ result.stderr, error_match });
+ print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
return parseError(tokenizer, code.source_token, "example did not have expected compile error", .{});
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
- try out.print("\n{}
\n", .{colored_stderr});
+ try out.print("\n{s}\n", .{colored_stderr});
},
Code.Id.TestSafety => |error_match| {
@@ -1294,31 +1294,31 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
- print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
+ print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
dumpArgs(test_args.items);
return parseError(tokenizer, code.source_token, "example test incorrectly succeeded", .{});
}
},
else => {
- print("{}\nThe following command crashed:\n", .{result.stderr});
+ print("{s}\nThe following command crashed:\n", .{result.stderr});
dumpArgs(test_args.items);
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
- print("{}\nExpected to find '{}' in stderr\n", .{ result.stderr, error_match });
+ print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
return parseError(tokenizer, code.source_token, "example did not have expected runtime safety error message", .{});
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
- try out.print("$ zig test {}.zig{}\n{}\n", .{
+ try out.print("$ zig test {s}.zig{s}\n{s}\n", .{
code.name,
mode_arg,
colored_stderr,
});
},
Code.Id.Obj => |maybe_error_match| {
- const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ code.name, obj_ext });
+ const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, obj_ext });
const tmp_obj_file_name = try fs.path.join(
allocator,
&[_][]const u8{ tmp_dir_name, name_plus_obj_ext },
@@ -1326,7 +1326,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
var build_args = std.ArrayList([]const u8).init(allocator);
defer build_args.deinit();
- const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{}.h", .{code.name});
+ const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{s}.h", .{code.name});
const output_h_file_name = try fs.path.join(
allocator,
&[_][]const u8{ tmp_dir_name, name_plus_h_ext },
@@ -1345,7 +1345,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
}),
});
if (!code.is_inline) {
- try out.print("$ zig build-obj {}.zig", .{code.name});
+ try out.print("$ zig build-obj {s}.zig", .{code.name});
}
switch (code.mode) {
@@ -1360,7 +1360,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
if (code.target_str) |triple| {
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
- try out.print(" -target {}", .{triple});
+ try out.print(" -target {s}", .{triple});
}
if (maybe_error_match) |error_match| {
@@ -1373,24 +1373,24 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
- print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
+ print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
dumpArgs(build_args.items);
return parseError(tokenizer, code.source_token, "example build incorrectly succeeded", .{});
}
},
else => {
- print("{}\nThe following command crashed:\n", .{result.stderr});
+ print("{s}\nThe following command crashed:\n", .{result.stderr});
dumpArgs(build_args.items);
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
- print("{}\nExpected to find '{}' in stderr\n", .{ result.stderr, error_match });
+ print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
return parseError(tokenizer, code.source_token, "example did not have expected compile error message", .{});
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
- try out.print("\n{}", .{colored_stderr});
+ try out.print("\n{s}", .{colored_stderr});
} else {
_ = exec(allocator, &env_map, build_args.items) catch return parseError(tokenizer, code.source_token, "example failed to compile", .{});
}
@@ -1416,7 +1416,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
tmp_dir_name, fs.path.sep_str, bin_basename,
}),
});
- try out.print("$ zig build-lib {}.zig", .{code.name});
+ try out.print("$ zig build-lib {s}.zig", .{code.name});
switch (code.mode) {
.Debug => {},
else => {
@@ -1426,12 +1426,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
}
if (code.target_str) |triple| {
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
- try out.print(" -target {}", .{triple});
+ try out.print(" -target {s}", .{triple});
}
const result = exec(allocator, &env_map, test_args.items) catch return parseError(tokenizer, code.source_token, "test failed", .{});
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const escaped_stdout = try escapeHtml(allocator, result.stdout);
- try out.print("\n{}{}
\n", .{ escaped_stderr, escaped_stdout });
+ try out.print("\n{s}{s}
\n", .{ escaped_stderr, escaped_stdout });
},
}
print("OK\n", .{});
@@ -1450,13 +1450,13 @@ fn exec(allocator: *mem.Allocator, env_map: *std.BufMap, args: []const []const u
switch (result.term) {
.Exited => |exit_code| {
if (exit_code != 0) {
- print("{}\nThe following command exited with code {}:\n", .{ result.stderr, exit_code });
+ print("{s}\nThe following command exited with code {}:\n", .{ result.stderr, exit_code });
dumpArgs(args);
return error.ChildExitError;
}
},
else => {
- print("{}\nThe following command crashed:\n", .{result.stderr});
+ print("{s}\nThe following command crashed:\n", .{result.stderr});
dumpArgs(args);
return error.ChildCrashed;
},
@@ -1471,7 +1471,7 @@ fn getBuiltinCode(allocator: *mem.Allocator, env_map: *std.BufMap, zig_exe: []co
fn dumpArgs(args: []const []const u8) void {
for (args) |arg|
- print("{} ", .{arg})
+ print("{s} ", .{arg})
else
print("\n", .{});
}
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 7c8d1c6662..9d89e894ad 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -236,7 +236,7 @@ const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
- try stdout.print("Hello, {}!\n", .{"world"});
+ try stdout.print("Hello, {s}!\n", .{"world"});
}
{#code_end#}
@@ -308,7 +308,7 @@ pub fn main() !void {
multiple arguments passed to a function, they are separated by commas ,.
- The two arguments passed to the stdout.print() function, "Hello, {}!\n"
+ The two arguments passed to the stdout.print() function, "Hello, {s}!\n"
and .{"world"}, are evaluated at {#link|compile-time|comptime#}. The code sample is
purposely written to show how to perform {#link|string|String Literals and Character Literals#}
substitution in the print function. The curly-braces inside of the first argument
@@ -435,7 +435,7 @@ pub fn main() void {
var optional_value: ?[]const u8 = null;
assert(optional_value == null);
- print("\noptional 1\ntype: {}\nvalue: {}\n", .{
+ print("\noptional 1\ntype: {s}\nvalue: {s}\n", .{
@typeName(@TypeOf(optional_value)),
optional_value,
});
@@ -443,7 +443,7 @@ pub fn main() void {
optional_value = "hi";
assert(optional_value != null);
- print("\noptional 2\ntype: {}\nvalue: {}\n", .{
+ print("\noptional 2\ntype: {s}\nvalue: {s}\n", .{
@typeName(@TypeOf(optional_value)),
optional_value,
});
@@ -451,14 +451,14 @@ pub fn main() void {
// error union
var number_or_error: anyerror!i32 = error.ArgNotFound;
- print("\nerror union 1\ntype: {}\nvalue: {}\n", .{
+ print("\nerror union 1\ntype: {s}\nvalue: {}\n", .{
@typeName(@TypeOf(number_or_error)),
number_or_error,
});
number_or_error = 1234;
- print("\nerror union 2\ntype: {}\nvalue: {}\n", .{
+ print("\nerror union 2\ntype: {s}\nvalue: {}\n", .{
@typeName(@TypeOf(number_or_error)),
number_or_error,
});
@@ -2339,7 +2339,7 @@ test "using slices for strings" {
// You can use slice syntax on an array to convert an array into a slice.
const all_together_slice = all_together[0..];
// String concatenation example.
- const hello_world = try fmt.bufPrint(all_together_slice, "{} {}", .{ hello, world });
+ const hello_world = try fmt.bufPrint(all_together_slice, "{s} {s}", .{ hello, world });
// Generally, you can use UTF-8 and not worry about whether something is a
// string. If you don't need to deal with individual characters, no need
@@ -2772,9 +2772,9 @@ const std = @import("std");
pub fn main() void {
const Foo = struct {};
- std.debug.print("variable: {}\n", .{@typeName(Foo)});
- std.debug.print("anonymous: {}\n", .{@typeName(struct {})});
- std.debug.print("function: {}\n", .{@typeName(List(i32))});
+ std.debug.print("variable: {s}\n", .{@typeName(Foo)});
+ std.debug.print("anonymous: {s}\n", .{@typeName(struct {})});
+ std.debug.print("function: {s}\n", .{@typeName(List(i32))});
}
fn List(comptime T: type) type {
@@ -6110,7 +6110,7 @@ const a_number: i32 = 1234;
const a_string = "foobar";
pub fn main() void {
- print("here is a string: '{}' here is a number: {}\n", .{a_string, a_number});
+ print("here is a string: '{s}' here is a number: {}\n", .{a_string, a_number});
}
{#code_end#}
@@ -6230,7 +6230,7 @@ const a_number: i32 = 1234;
const a_string = "foobar";
test "printf too many arguments" {
- print("here is a string: '{}' here is a number: {}\n", .{
+ print("here is a string: '{s}' here is a number: {}\n", .{
a_string,
a_number,
a_number,
@@ -6249,7 +6249,7 @@ const print = @import("std").debug.print;
const a_number: i32 = 1234;
const a_string = "foobar";
-const fmt = "here is a string: '{}' here is a number: {}\n";
+const fmt = "here is a string: '{s}' here is a number: {}\n";
pub fn main() void {
print(fmt, .{a_string, a_number});
@@ -6720,8 +6720,8 @@ fn amain() !void {
const download_text = try await download_frame;
defer allocator.free(download_text);
- std.debug.print("download_text: {}\n", .{download_text});
- std.debug.print("file_text: {}\n", .{file_text});
+ std.debug.print("download_text: {s}\n", .{download_text});
+ std.debug.print("file_text: {s}\n", .{file_text});
}
var global_download_frame: anyframe = undefined;
@@ -6790,8 +6790,8 @@ fn amain() !void {
const download_text = try await download_frame;
defer allocator.free(download_text);
- std.debug.print("download_text: {}\n", .{download_text});
- std.debug.print("file_text: {}\n", .{file_text});
+ std.debug.print("download_text: {s}\n", .{download_text});
+ std.debug.print("file_text: {s}\n", .{file_text});
}
fn fetchUrl(allocator: *Allocator, url: []const u8) ![]u8 {
@@ -8848,7 +8848,7 @@ pub fn main() !void {
var byte: u8 = 255;
byte = if (math.add(u8, byte, 1)) |result| result else |err| {
- print("unable to add one: {}\n", .{@errorName(err)});
+ print("unable to add one: {s}\n", .{@errorName(err)});
return err;
};
@@ -9078,7 +9078,7 @@ pub fn main() void {
if (result) |number| {
print("got number: {}\n", .{number});
} else |err| {
- print("got error: {}\n", .{@errorName(err)});
+ print("got error: {s}\n", .{@errorName(err)});
}
}
@@ -9135,7 +9135,7 @@ const Foo = enum {
pub fn main() void {
var a: u2 = 3;
var b = @intToEnum(Foo, a);
- std.debug.print("value: {}\n", .{@tagName(b)});
+ std.debug.print("value: {s}\n", .{@tagName(b)});
}
{#code_end#}
{#header_close#}
@@ -10025,7 +10025,7 @@ pub fn main() !void {
defer std.process.argsFree(gpa, args);
for (args) |arg, i| {
- std.debug.print("{}: {}\n", .{ i, arg });
+ std.debug.print("{}: {s}\n", .{ i, arg });
}
}
{#code_end#}
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index d1f025c929..80cc7f930d 100644
--- a/lib/std/testing.zig
+++ b/lib/std/testing.zig
@@ -29,8 +29,7 @@ pub var zig_exe_path: []const u8 = undefined;
/// and then aborts when actual_error_union is not expected_error.
pub fn expectError(expected_error: anyerror, actual_error_union: anytype) void {
if (actual_error_union) |actual_payload| {
- // std.debug.panic("expected error.{s}, found {}", .{ @errorName(expected_error), actual_payload });
- std.debug.panic("expected error.{s}, found", .{@errorName(expected_error)});
+ std.debug.panic("expected error.{s}, found {}", .{ @errorName(expected_error), actual_payload });
} else |actual_error| {
if (expected_error != actual_error) {
std.debug.panic("expected error.{s}, found error.{s}", .{
diff --git a/src/astgen.zig b/src/astgen.zig
index b4e1760368..b3cb648dcb 100644
--- a/src/astgen.zig
+++ b/src/astgen.zig
@@ -560,14 +560,14 @@ fn varDecl(
.local_val => {
const local_val = s.cast(Scope.LocalVal).?;
if (mem.eql(u8, local_val.name, ident_name)) {
- return mod.fail(scope, name_src, "redefinition of '{}'", .{ident_name});
+ return mod.fail(scope, name_src, "redefinition of '{s}'", .{ident_name});
}
s = local_val.parent;
},
.local_ptr => {
const local_ptr = s.cast(Scope.LocalPtr).?;
if (mem.eql(u8, local_ptr.name, ident_name)) {
- return mod.fail(scope, name_src, "redefinition of '{}'", .{ident_name});
+ return mod.fail(scope, name_src, "redefinition of '{s}'", .{ident_name});
}
s = local_ptr.parent;
},
@@ -578,7 +578,7 @@ fn varDecl(
// Namespace vars shadowing detection
if (mod.lookupDeclName(scope, ident_name)) |_| {
- return mod.fail(scope, name_src, "redefinition of '{}'", .{ident_name});
+ return mod.fail(scope, name_src, "redefinition of '{s}'", .{ident_name});
}
const init_node = node.getInitNode() orelse
return mod.fail(scope, name_src, "variables must be initialized", .{});
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index d4a61c8149..3f8544a4e8 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -620,7 +620,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
try argv.append(cur_vers);
}
- const dylib_install_name = try std.fmt.allocPrint(arena, "@rpath/{}", .{self.base.options.emit.?.sub_path});
+ const dylib_install_name = try std.fmt.allocPrint(arena, "@rpath/{s}", .{self.base.options.emit.?.sub_path});
try argv.append("-install_name");
try argv.append(dylib_install_name);
}