diff --git a/src/InternPool.zig b/src/InternPool.zig index 9a0aa78e814291caacd7d2e852697f7b37e87586..be6e45441e55ec373e533643786528d0abeb310c 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -2147,9 +2147,11 @@ pub const Key = union(enum) { }; }; - pub const SpirvType = struct { + pub const SpirvType = extern struct { /// A `spirv_reify` instruction. zir_index: TrackedInst.Index, + /// Always 0. + padding: u32 = 0, /// A hash of this type's attributes generated by Sema. type_hash: u64, }; @@ -2591,7 +2593,6 @@ pub const Key = union(enum) { const KeyTag = @typeInfo(Key).@"union".tag_type.?; const seed = @intFromEnum(@as(KeyTag, key)); return switch (key) { - // TODO: assert no padding in these types inline .ptr_type, .array_type, .vector_type, @@ -2608,7 +2609,11 @@ pub const Key = union(enum) { .enum_tag, .inferred_error_set_type, .un, - => |x| Hash.hash(seed, asBytes(&x)), + => |x| { + _ = extern struct { is_extern: @TypeOf(x) }; + comptime assert(std.meta.hasUniqueRepresentation(@TypeOf(x))); + return Hash.hash(seed, asBytes(&x)); + }, .int_type => |x| Hash.hash(seed + @intFromEnum(x.signedness), asBytes(&x.bits)),