]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / ui / nll / ty-outlives / projection-where-clause-env-wrong-lifetime.rs
1 // Test that if we need to prove that `<T as MyTrait<'a>>::Output:
2 // 'a`, but we only know that `<T as MyTrait<'b>>::Output: 'a`, that
3 // doesn't suffice.
4
5 trait MyTrait<'a> {
6 type Output;
7 }
8
9 fn foo1<'a, 'b, T>() -> &'a ()
10 where
11 for<'x> T: MyTrait<'x>,
12 <T as MyTrait<'b>>::Output: 'a,
13 {
14 bar::<<T as MyTrait<'a>>::Output>()
15 //~^ ERROR the associated type `<T as MyTrait<'a>>::Output` may not live long enough
16 }
17
18 fn bar<'a, T>() -> &'a ()
19 where
20 T: 'a,
21 {
22 &()
23 }
24
25 fn main() {}