]> git.proxmox.com Git - rustc.git/blob - src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-44005.rs
New upstream version 1.58.1+dfsg1
[rustc.git] / src / test / ui / higher-rank-trait-bounds / normalize-under-binder / issue-44005.rs
1 // check-pass
2
3 pub trait Foo<'a> {
4 type Bar;
5 fn foo(&'a self) -> Self::Bar;
6 }
7
8 impl<'a, 'b, T: 'a> Foo<'a> for &'b T {
9 type Bar = &'a T;
10 fn foo(&'a self) -> &'a T {
11 self
12 }
13 }
14
15 pub fn uncallable<T, F>(x: T, f: F)
16 where
17 T: for<'a> Foo<'a>,
18 F: for<'a> Fn(<T as Foo<'a>>::Bar),
19 {
20 f(x.foo());
21 }
22
23 pub fn catalyst(x: &i32) {
24 broken(x, |_| {})
25 }
26
27 pub fn broken<F: Fn(&i32)>(x: &i32, f: F) {
28 uncallable(x, |y| f(y));
29 }
30
31 fn main() {}