Make invalidFmtError public and use in place of compileErrors for bad format strings (#13526)

* Export invalidFmtErr

To allow consistent use of "invalid format string" compile error
response for badly formatted format strings.

See https://github.com/ziglang/zig/pull/13489#issuecomment-1311759340.

* Replace format compile errors with invalidFmtErr

- Provides more consistent compile errors.
- Gives user info about the type of the badly formated value.

* Rename invalidFmtErr as invalidFmtError

For consistency. Zig seems to use “Error” more often than “Err”.

* std: add invalid format string checks to remaining custom formatters

* pass reference-trace to comp when building build file; fix checkobjectstep
This commit is contained in:
Nick Cernis
2022-11-12 20:03:24 +01:00
committed by GitHub
parent 32b97df50e
commit 8a5818535b
18 changed files with 52 additions and 43 deletions

View File

@@ -2123,7 +2123,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = fmt;
if (fmt.len != 0) std.fmt.invalidFmtError(fmt, t);
_ = options;
if (enabled) {
try writer.writeAll("\n");