Commit 7e47f106cc

Andrew Kelley <andrew@ziglang.org>
2022-03-28 21:03:58
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 parent c38b4bc
Changed files (1)
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,
         }
     }