Commit 0c16912733

Veikka Tuominen <git@vexu.eu>
2023-03-16 16:46:34
std: improve error for formatting a function body type
Closes #14915
1 parent 30427ff
Changed files (1)
lib
lib/std/fmt.zig
@@ -703,10 +703,7 @@ pub fn formatType(
             }
             try writer.writeAll(" }");
         },
-        .Fn => {
-            if (actual_fmt.len != 0) invalidFmtError(fmt, value);
-            return format(writer, "{s}@{x}", .{ @typeName(T), @ptrToInt(value) });
-        },
+        .Fn => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
         .Type => {
             if (actual_fmt.len != 0) invalidFmtError(fmt, value);
             return formatBuf(@typeName(value), options, writer);