Skip to content

Commit 1fc9432

Browse files
committed
std: fmt "{s}" specifier needs an explicit cast
1 parent fb39a19 commit 1fc9432

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/std/fmt.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ pub fn formatType(
448448
}
449449
if (ptr_info.child == u8) {
450450
if (fmt.len > 0 and fmt[0] == 's') {
451-
const len = mem.len(u8, value);
452-
return formatText(value[0..len], fmt, options, context, Errors, output);
451+
const slice = mem.pointerToSlice([:0]const u8, @as([*:0]const u8, value));
452+
return formatText(slice, fmt, options, context, Errors, output);
453453
}
454454
}
455455
return format(context, Errors, output, "{}@{x}", .{ @typeName(T.Child), @ptrToInt(value) });

0 commit comments

Comments
 (0)