zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 7e47f106ccf73af4c890ecbb4d48e9e92d38d3c4 (tree)
parent c38b4bcee7c9e6913fdf95c1572a7d8125eab1a4
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Mon, 28 Mar 2022 12:03:58 -0700

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.

Diffstat:
Msrc/value.zig | 8+-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/value.zig b/src/value.zig @@ -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, } }