Value: handle runtime_int in hashPtr

Closes #12702
This commit is contained in:
Veikka Tuominen 2022-10-19 01:59:31 +03:00
parent 9a52abf3b4
commit ce95cc170b
2 changed files with 14 additions and 0 deletions

View File

@ -2555,6 +2555,9 @@ pub const Value = extern union {
.lazy_size,
=> return hashInt(ptr_val, hasher, target),
// The value is runtime-known and shouldn't affect the hash.
.runtime_int => {},
else => unreachable,
}
}

View File

@ -20,3 +20,14 @@ test "@src" {
try doTheTest();
}
test "@src used as a comptime parameter" {
const S = struct {
fn Foo(comptime _: std.builtin.SourceLocation) type {
return struct {};
}
};
const T1 = S.Foo(@src());
const T2 = S.Foo(@src());
try expect(T1 != T2);
}