Skip to content

Commit b129de4

Browse files
committed
Regression test for rust-lang#58435.
1 parent a9da8fc commit b129de4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// The const-evaluator was at one point ICE'ing while trying to
2+
// evaluate the body of `fn id` during the `s.id()` call in main.
3+
4+
struct S<T>(T);
5+
6+
impl<T> S<T> {
7+
const ID: fn(&S<T>) -> &S<T> = |s| s;
8+
pub fn id(&self) -> &Self {
9+
Self::ID(self) // This, plus call below ...
10+
}
11+
}
12+
13+
fn main() {
14+
let s = S(10u32);
15+
assert!(S::<u32>::ID(&s).0 == 10); // Works fine
16+
assert!(s.id().0 == 10); // ... causes compiler to panic
17+
}

0 commit comments

Comments
 (0)