From 114244f7701c5bda996e852fbadcab76a488bdf6 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sun, 20 Nov 2022 21:33:05 +0100 Subject: [PATCH] value: account for undef value for ptr in slice in hashUncoerced --- src/value.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/value.zig b/src/value.zig index 59cf9046f4..43c31905ca 100644 --- a/src/value.zig +++ b/src/value.zig @@ -2581,7 +2581,12 @@ pub const Value = extern union { }, .Float, .ComptimeFloat => std.hash.autoHash(hasher, @bitCast(u128, val.toFloat(f128))), .Bool, .Int, .ComptimeInt, .Pointer, .Fn => switch (val.tag()) { - .slice => val.castTag(.slice).?.data.ptr.hashPtr(hasher, mod.getTarget()), + .slice => { + const slice = val.castTag(.slice).?.data; + var ptr_buf: Type.SlicePtrFieldTypeBuffer = undefined; + const ptr_ty = ty.slicePtrFieldType(&ptr_buf); + slice.ptr.hashUncoerced(ptr_ty, hasher, mod); + }, else => val.hashPtr(hasher, mod.getTarget()), }, .Array, .Vector => {