Value.hashPtr: handle lazy_align as an integer

Although lazy_align is a different tag than integer values, it needs to
be hashed and equality-tested as if it were a simple integer. Otherwise
our basic data structure guarantees fall apart.
This commit is contained in:
Andrew Kelley 2022-03-28 12:03:58 -07:00
parent c38b4bcee7
commit 7e47f106cc

View File

@ -2476,15 +2476,9 @@ pub const Value = extern union {
.bool_false,
.bool_true,
.the_only_possible_value,
.lazy_align,
=> return hashInt(ptr_val, hasher, target),
.lazy_align => {
// Bit weird to have this here but this function is also called
// on integers.
const ty = ptr_val.castTag(.lazy_align).?.data;
ty.hashWithHasher(hasher, target);
},
else => unreachable,
}
}