aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-06-02 18:49:40 -0400
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:59 -0700
commite23b0a01e6357252eb2c08a83eff9169ce49042c (patch)
tree86742fd9ad29116eddc61c1e093ae8155a435fb4 /src/type.zig
parent6a15fc87ad62ec0509017c960f6983ce1493c31d (diff)
downloadzig-e23b0a01e6357252eb2c08a83eff9169ce49042c.tar.gz
zig-e23b0a01e6357252eb2c08a83eff9169ce49042c.zip
InternPool: fix yet more key lifetime issues
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig
index 43aaf3c786..d9ae710b2d 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -2576,9 +2576,12 @@ pub const Type = struct {
}
// In this case the struct has all comptime-known fields and
// therefore has one possible value.
+ // TODO: write something like getCoercedInts to avoid needing to dupe
+ const duped_values = try mod.gpa.dupe(InternPool.Index, tuple.values);
+ defer mod.gpa.free(duped_values);
return (try mod.intern(.{ .aggregate = .{
.ty = ty.toIntern(),
- .storage = .{ .elems = tuple.values },
+ .storage = .{ .elems = duped_values },
} })).toValue();
},