Commit 4ef7d85810
Changed files (2)
lib
std
doc/langref.html.in
@@ -7228,7 +7228,7 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
<p>
And now, what happens if we give too many arguments to {#syntax#}print{#endsyntax#}?
</p>
- {#code_begin|test_err|Unused argument in 'here is a string: '{s}' here is a number: {}#}
+ {#code_begin|test_err|unused argument in 'here is a string: '{s}' here is a number: {}#}
const print = @import("std").debug.print;
const a_number: i32 = 1234;
lib/std/fmt.zig
@@ -83,7 +83,7 @@ pub fn format(
const ArgsType = @TypeOf(args);
const args_type_info = @typeInfo(ArgsType);
if (args_type_info != .Struct) {
- @compileError("Expected tuple or struct argument, found " ++ @typeName(ArgsType));
+ @compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
}
const fields_info = args_type_info.Struct.fields;
@@ -127,7 +127,7 @@ pub fn format(
if (i >= fmt.len) break;
if (fmt[i] == '}') {
- @compileError("Missing opening {");
+ @compileError("missing opening {");
}
// Get past the {
@@ -140,7 +140,7 @@ pub fn format(
const fmt_end = i;
if (i >= fmt.len) {
- @compileError("Missing closing }");
+ @compileError("missing closing }");
}
// Get past the }
@@ -152,7 +152,7 @@ pub fn format(
.none => null,
.number => |pos| pos,
.named => |arg_name| meta.fieldIndex(ArgsType, arg_name) orelse
- @compileError("No argument with name '" ++ arg_name ++ "'"),
+ @compileError("no argument with name '" ++ arg_name ++ "'"),
};
const width = switch (placeholder.width) {
@@ -160,8 +160,8 @@ pub fn format(
.number => |v| v,
.named => |arg_name| blk: {
const arg_i = comptime meta.fieldIndex(ArgsType, arg_name) orelse
- @compileError("No argument with name '" ++ arg_name ++ "'");
- _ = comptime arg_state.nextArg(arg_i) orelse @compileError("Too few arguments");
+ @compileError("no argument with name '" ++ arg_name ++ "'");
+ _ = comptime arg_state.nextArg(arg_i) orelse @compileError("too few arguments");
break :blk @field(args, arg_name);
},
};
@@ -171,14 +171,14 @@ pub fn format(
.number => |v| v,
.named => |arg_name| blk: {
const arg_i = comptime meta.fieldIndex(ArgsType, arg_name) orelse
- @compileError("No argument with name '" ++ arg_name ++ "'");
- _ = comptime arg_state.nextArg(arg_i) orelse @compileError("Too few arguments");
+ @compileError("no argument with name '" ++ arg_name ++ "'");
+ _ = comptime arg_state.nextArg(arg_i) orelse @compileError("too few arguments");
break :blk @field(args, arg_name);
},
};
const arg_to_print = comptime arg_state.nextArg(arg_pos) orelse
- @compileError("Too few arguments");
+ @compileError("too few arguments");
try formatType(
@field(args, fields_info[arg_to_print].name),
@@ -198,7 +198,7 @@ pub fn format(
const missing_count = arg_state.args_len - @popCount(ArgSetType, arg_state.used_args);
switch (missing_count) {
0 => unreachable,
- 1 => @compileError("Unused argument in '" ++ fmt ++ "'"),
+ 1 => @compileError("unused argument in '" ++ fmt ++ "'"),
else => @compileError((comptime comptimePrint("{d}", .{missing_count})) ++ " unused arguments in '" ++ fmt ++ "'"),
}
}
@@ -217,7 +217,7 @@ fn parsePlaceholder(comptime str: anytype) Placeholder {
// Skip the colon, if present
if (comptime parser.char()) |ch| {
if (ch != ':') {
- @compileError("Expected : or }, found '" ++ [1]u8{ch} ++ "'");
+ @compileError("expected : or }, found '" ++ [1]u8{ch} ++ "'");
}
}
@@ -252,7 +252,7 @@ fn parsePlaceholder(comptime str: anytype) Placeholder {
// Skip the dot, if present
if (comptime parser.char()) |ch| {
if (ch != '.') {
- @compileError("Expected . or }, found '" ++ [1]u8{ch} ++ "'");
+ @compileError("expected . or }, found '" ++ [1]u8{ch} ++ "'");
}
}
@@ -261,7 +261,7 @@ fn parsePlaceholder(comptime str: anytype) Placeholder {
@compileError(@errorName(err));
if (comptime parser.char()) |ch| {
- @compileError("Extraneous trailing character '" ++ [1]u8{ch} ++ "'");
+ @compileError("extraneous trailing character '" ++ [1]u8{ch} ++ "'");
}
return Placeholder{
@@ -423,7 +423,7 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T
else => {},
}
- @compileError("Cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier");
+ @compileError("cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier");
}
// This ANY const is a workaround for: https://github.com/ziglang/zig/issues/7948
@@ -608,7 +608,7 @@ pub fn formatType(
}
return;
}
- @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
+ @compileError("unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
},
.Enum, .Union, .Struct => {
return formatType(value.*, actual_fmt, options, writer, max_depth);
@@ -630,7 +630,7 @@ pub fn formatType(
else => {},
}
}
- @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
+ @compileError("unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
},
.Slice => {
if (actual_fmt.len == 0)
@@ -701,7 +701,7 @@ pub fn formatType(
return formatBuf(buffer, options, writer);
},
.Null => return formatBuf("null", options, writer),
- else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),
+ else => @compileError("unable to format type '" ++ @typeName(T) ++ "'"),
}
}
@@ -747,13 +747,13 @@ pub fn formatIntValue(
if (@typeInfo(@TypeOf(int_value)).Int.bits <= 8) {
return formatAsciiChar(@as(u8, int_value), options, writer);
} else {
- @compileError("Cannot print integer that is larger than 8 bits as an ASCII character");
+ @compileError("cannot print integer that is larger than 8 bits as an ASCII character");
}
} else if (comptime std.mem.eql(u8, fmt, "u")) {
if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {
return formatUnicodeCodepoint(@as(u21, int_value), options, writer);
} else {
- @compileError("Cannot print integer that is larger than 21 bits as an UTF-8 sequence");
+ @compileError("cannot print integer that is larger than 21 bits as an UTF-8 sequence");
}
} else if (comptime std.mem.eql(u8, fmt, "b")) {
radix = 2;
@@ -768,7 +768,7 @@ pub fn formatIntValue(
radix = 8;
case = .lower;
} else {
- @compileError("Unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'");
+ @compileError("unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'");
}
return formatInt(int_value, radix, case, options, writer);
@@ -797,7 +797,7 @@ fn formatFloatValue(
error.NoSpaceLeft => unreachable,
};
} else {
- @compileError("Unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'");
+ @compileError("unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'");
}
return formatBuf(buf_stream.getWritten(), options, writer);
@@ -959,7 +959,7 @@ pub fn fmtIntSizeBin(value: u64) std.fmt.Formatter(formatSizeBin) {
fn checkTextFmt(comptime fmt: []const u8) void {
if (fmt.len != 1)
- @compileError("Unsupported format string '" ++ fmt ++ "' when formatting text");
+ @compileError("unsupported format string '" ++ fmt ++ "' when formatting text");
switch (fmt[0]) {
'x' => @compileError("specifier 'x' has been deprecated, wrap your argument in std.fmt.fmtSliceHexLower instead"),
'X' => @compileError("specifier 'X' has been deprecated, wrap your argument in std.fmt.fmtSliceHexUpper instead"),
@@ -2377,7 +2377,7 @@ test "custom" {
} else if (comptime std.mem.eql(u8, fmt, "d")) {
return std.fmt.format(writer, "{d:.3}x{d:.3}", .{ self.x, self.y });
} else {
- @compileError("Unknown format character: '" ++ fmt ++ "'");
+ @compileError("unknown format character: '" ++ fmt ++ "'");
}
}
};
@@ -2585,7 +2585,7 @@ test "formatType max_depth" {
if (fmt.len == 0) {
return std.fmt.format(writer, "({d:.3},{d:.3})", .{ self.x, self.y });
} else {
- @compileError("Unknown format string: '" ++ fmt ++ "'");
+ @compileError("unknown format string: '" ++ fmt ++ "'");
}
}
};