From 0c169127338ef8af752d1a077e412b5135e300d5 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Thu, 16 Mar 2023 17:46:34 +0200 Subject: [PATCH] std: improve error for formatting a function body type Closes #14915 --- lib/std/fmt.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 8167a2b252..1658f8a502 100644 --- a/lib/std/fmt.zig +++ b/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);