summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-74261.rs
blob: 93ccb42684c5e6e858dfc0e745f13d4044102ddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// check-pass

use std::marker::PhantomData;

trait A<'a> {
    type B;
    fn b(self) -> Self::B;
}

struct T;
struct S<'a>(PhantomData<&'a ()>);

impl<'a> A<'a> for T {
    type B = S<'a>;
    fn b(self) -> Self::B {
        S(PhantomData)
    }
}

fn s<TT, F>(t: TT, f: F)
where
    TT: for<'a> A<'a>,
    F: for<'a> FnOnce(<TT as A<'a>>::B)
{
    f(t.b());
}

fn main() {
    s(T, |_| {});
}