value: account for undef value for ptr in slice in hashUncoerced

This commit is contained in:
Jakub Konka 2022-11-20 21:33:05 +01:00 committed by Veikka Tuominen
parent 3fa226a80c
commit 114244f770

View File

@ -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 => {