authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-28 12:03:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-28 12:05:08-07:00
log7e47f106ccf73af4c890ecbb4d48e9e92d38d3c4
treeccd3bffee8bb0d866715216da196e1b69b676fb1
parentc38b4bcee7c9e6913fdf95c1572a7d8125eab1a4

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.

1 files changed, 1 insertions(+), 7 deletions(-)

src/value.zig+1-7
......@@ -2476,15 +2476,9 @@ pub const Value = extern union {
24762476 .bool_false,
24772477 .bool_true,
24782478 .the_only_possible_value,
2479 .lazy_align,
24792480 => return hashInt(ptr_val, hasher, target),
24802481
2481 .lazy_align => {
2482 // Bit weird to have this here but this function is also called
2483 // on integers.
2484 const ty = ptr_val.castTag(.lazy_align).?.data;
2485 ty.hashWithHasher(hasher, target);
2486 },
2487
24882482 else => unreachable,
24892483 }
24902484 }