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 {...@@ -2476,15 +2476,9 @@ pub const Value = extern union {
2476 .bool_false,2476 .bool_false,
2477 .bool_true,2477 .bool_true,
2478 .the_only_possible_value,2478 .the_only_possible_value,
2479 .lazy_align,
2479 => return hashInt(ptr_val, hasher, target),2480 => 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
2488 else => unreachable,2482 else => unreachable,
2489 }2483 }
2490 }2484 }