summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs
blob: 987148dcefb0c869d5a1d7dfd5df14abd4f624df (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
// Test that if we need to prove that `<T as MyTrait<'a>>::Output:
// 'a`, but we only know that `<T as MyTrait<'b>>::Output: 'a`, that
// doesn't suffice.

trait MyTrait<'a> {
    type Output;
}

fn foo1<'a, 'b, T>() -> &'a ()
where
    for<'x> T: MyTrait<'x>,
    <T as MyTrait<'b>>::Output: 'a,
{
    bar::<<T as MyTrait<'a>>::Output>()
    //~^ ERROR the associated type `<T as MyTrait<'_>>::Output` may not live long enough
}

fn bar<'a, T>() -> &'a ()
where
    T: 'a,
{
    &()
}

fn main() {}