authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-19 01:59:31+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-20 20:11:12+03:00
logce95cc170bfa763d31fc498169ee9e44adca57fa
tree3cee5eca0147f968931af63d153e8ede95783aee
parent9a52abf3b47447b4ce976a99daca1c9c859c5aca

Value: handle runtime_int in hashPtr

Closes #12702

2 files changed, 14 insertions(+), 0 deletions(-)

src/value.zig+3
......@@ -2555,6 +2555,9 @@ pub const Value = extern union {
25552555 .lazy_size,
25562556 => return hashInt(ptr_val, hasher, target),
25572557
2558 // The value is runtime-known and shouldn't affect the hash.
2559 .runtime_int => {},
2560
25582561 else => unreachable,
25592562 }
25602563 }
test/behavior/src.zig+11
......@@ -20,3 +20,14 @@ test "@src" {
2020
2121 try doTheTest();
2222}
23
24test "@src used as a comptime parameter" {
25 const S = struct {
26 fn Foo(comptime _: std.builtin.SourceLocation) type {
27 return struct {};
28 }
29 };
30 const T1 = S.Foo(@src());
31 const T2 = S.Foo(@src());
32 try expect(T1 != T2);
33}