Skip to content

Commit 787a0cc

Browse files
committed
Add 81403
Issue: rust-lang/rust#81403
1 parent 7872b31 commit 787a0cc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

ices/81403.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
rustc --emit=mir -Zmir-opt-level=2 - <<'EOF'
4+
// build-pass
5+
pub trait Foo<'a> {
6+
type Bar;
7+
fn foo(&'a self) -> Self::Bar;
8+
}
9+
10+
impl<'a, 'b, T: 'a> Foo<'a> for &'b T {
11+
type Bar = &'a T;
12+
fn foo(&'a self) -> &'a T {
13+
self
14+
}
15+
}
16+
17+
pub fn uncallable<T, F>(x: T, f: F)
18+
where T: for<'a> Foo<'a>,
19+
F: for<'a> Fn(<T as Foo<'a>>::Bar)
20+
{
21+
f(x.foo());
22+
}
23+
24+
pub fn broken<F: Fn(&i32)>(x: &i32, f: F) {
25+
uncallable(x, |y| f(y));
26+
}
27+
28+
fn main() { }
29+
EOF

0 commit comments

Comments
 (0)