std.fmt: add name of type in unsupport format string compile error

This commit is contained in:
Meghan 2021-08-13 21:21:34 -07:00 committed by Veikka Tuominen
parent c2635f9b02
commit fcf2ce0ffe

View File

@ -544,7 +544,7 @@ pub fn formatType(
return formatText(value, actual_fmt, options, writer); return formatText(value, actual_fmt, options, writer);
} }
} }
@compileError("Unknown format string: '" ++ actual_fmt ++ "'"); @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
}, },
.Enum, .Union, .Struct => { .Enum, .Union, .Struct => {
return formatType(value.*, actual_fmt, options, writer, max_depth); return formatType(value.*, actual_fmt, options, writer, max_depth);
@ -562,7 +562,7 @@ pub fn formatType(
return formatText(mem.span(value), actual_fmt, options, writer); return formatText(mem.span(value), actual_fmt, options, writer);
} }
} }
@compileError("Unknown format string: '" ++ actual_fmt ++ "'"); @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
}, },
.Slice => { .Slice => {
if (actual_fmt.len == 0) if (actual_fmt.len == 0)