authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-11-06 14:40:34-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-11-06 14:40:34-08:00
log4937aeff8448a512f5b305ac1c3f9c35354b5659
tree5cbd934d5a38e15f2b66ae2c351c5d3671410c80
parentb2895f356fa6203d0f3f1476c4e8fb9cf5b6d860
parentb4b54b597d59b709b7d801db55c7705c8e950d4e
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25714 from snoire/enum-literal-format-support

std.Io.Writer.print: support .enum_literal in 't' format specifier

2 files changed, 2 insertions(+), 1 deletions(-)

lib/std/Io/Writer.zig+1-1
......@@ -1161,7 +1161,7 @@ pub fn printValue(
11611161 },
11621162 't' => switch (@typeInfo(T)) {
11631163 .error_set => return w.alignBufferOptions(@errorName(value), options),
1164 .@"enum", .@"union" => return w.alignBufferOptions(@tagName(value), options),
1164 .@"enum", .enum_literal, .@"union" => return w.alignBufferOptions(@tagName(value), options),
11651165 else => invalidFmtError(fmt, value),
11661166 },
11671167 else => {},
lib/std/fmt.zig+1
......@@ -1249,6 +1249,7 @@ test "vector" {
12491249
12501250test "enum-literal" {
12511251 try expectFmt(".hello_world", "{}", .{.hello_world});
1252 try expectFmt("hello_world", "{t}", .{.hello_world});
12521253}
12531254
12541255test "padding" {