| ... | @@ -1182,10 +1182,12 @@ fn bufPrintIntToSlice(buf: []u8, value: anytype, base: u8, uppercase: bool, opti | ... | @@ -1182,10 +1182,12 @@ fn bufPrintIntToSlice(buf: []u8, value: anytype, base: u8, uppercase: bool, opti |
| 1182 | } | 1182 | } |
| 1183 | | 1183 | |
| 1184 | pub fn comptimePrint(comptime fmt: []const u8, args: anytype) *const [count(fmt, args):0]u8 { | 1184 | pub fn comptimePrint(comptime fmt: []const u8, args: anytype) *const [count(fmt, args):0]u8 { |
| 1185 | comptime var buf: [count(fmt, args):0]u8 = undefined; | 1185 | comptime { |
| 1186 | _ = bufPrint(&buf, fmt, args) catch unreachable; | 1186 | var buf: [count(fmt, args):0]u8 = undefined; |
| 1187 | buf[buf.len] = 0; | 1187 | _ = bufPrint(&buf, fmt, args) catch unreachable; |
| 1188 | return &buf; | 1188 | buf[buf.len] = 0; |
| | 1189 | return &buf; |
| | 1190 | } |
| 1189 | } | 1191 | } |
| 1190 | | 1192 | |
| 1191 | test "comptimePrint" { | 1193 | test "comptimePrint" { |