From 7e47f106ccf73af4c890ecbb4d48e9e92d38d3c4 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 28 Mar 2022 12:03:58 -0700 Subject: [PATCH] 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. --- src/value.zig | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/value.zig b/src/value.zig index 926a52c2b7..c7960741f6 100644 --- 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, } }