From 92458094c8f8294d7bb50d28b09dd2c02b03a25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20=C3=85stholm?= Date: Sun, 7 Jan 2024 15:54:47 +0100 Subject: [PATCH] Fix failing type reifications --- lib/std/meta.zig | 2 +- test/behavior/type.zig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 41b3ca291f..94d5f962bc 100644 --- a/lib/std/meta.zig +++ b/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, diff --git a/test/behavior/type.zig b/test/behavior/type.zig index 7cb9212c30..1ce31fecfd 100644 --- a/test/behavior/type.zig +++ b/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,