Commit fcf2ce0ffe

Meghan <hello@nektro.net>
2021-08-14 06:21:34
std.fmt: add name of type in unsupport format string compile error
1 parent c2635f9
Changed files (1)
lib
lib/std/fmt.zig
@@ -544,7 +544,7 @@ pub fn formatType(
                             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 => {
                     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);
                     }
                 }
-                @compileError("Unknown format string: '" ++ actual_fmt ++ "'");
+                @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
             },
             .Slice => {
                 if (actual_fmt.len == 0)