aboutsummaryrefslogtreecommitdiff
path: root/std/fmt
diff options
context:
space:
mode:
Diffstat (limited to 'std/fmt')
-rw-r--r--std/fmt/index.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/std/fmt/index.zig b/std/fmt/index.zig
index cfc0948d2c..90d3a559c4 100644
--- a/std/fmt/index.zig
+++ b/std/fmt/index.zig
@@ -162,8 +162,6 @@ pub fn formatType(
},
builtin.TypeInfo.Pointer.Size.Many => {
if (ptr_info.child == u8) {
- //This is a bit of a hack, but it made more sense to
- // do this check here than have formatText do it
if (fmt[0] == 's') {
const len = std.cstr.len(value);
return formatText(value[0..len], fmt, context, Errors, output);
@@ -176,6 +174,12 @@ pub fn formatType(
return output(context, casted_value);
},
},
+ builtin.TypeId.Array => |info| {
+ if (info.child == u8) {
+ return formatText(value, fmt, context, Errors, output);
+ }
+ return format(context, Errors, output, "{}@{x}", @typeName(T.Child), @ptrToInt(&value));
+ },
else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),
}
}