Commit 92458094c8

Carl Åstholm <carl@astholm.se>
2024-01-07 15:54:47
Fix failing type reifications
1 parent c8fa767
Changed files (2)
lib
test
behavior
lib/std/meta.zig
@@ -1015,7 +1015,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
         @setEvalBranchQuota(10_000);
         var num_buf: [128]u8 = undefined;
         tuple_fields[i] = .{
-            .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable,
+            .name = std.fmt.bufPrintZ(&num_buf, "{d}", .{i}) catch unreachable,
             .type = T,
             .default_value = null,
             .is_comptime = false,
test/behavior/type.zig
@@ -549,7 +549,7 @@ test "Type.Fn" {
 
 test "reified struct field name from optional payload" {
     comptime {
-        const m_name: ?[1]u8 = "a".*;
+        const m_name: ?[1:0]u8 = "a".*;
         if (m_name) |*name| {
             const T = @Type(.{ .Struct = .{
                 .layout = .Auto,
@@ -711,7 +711,7 @@ test "struct field names sliced at comptime from larger string" {
         while (it.next()) |name| {
             fields = fields ++ &[_]Type.StructField{.{
                 .alignment = 0,
-                .name = name,
+                .name = name ++ "",
                 .type = usize,
                 .default_value = null,
                 .is_comptime = false,