]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/ty-outlives/projection-where-clause-none.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / ty-outlives / projection-where-clause-none.rs
1 // Test that we are NOT able to establish that `<T as
2 // MyTrait<'a>>::Output: 'a` outlives `'a` here -- we have only one
3 // recourse, which is to prove that `T: 'a` and `'a: 'a`, but we don't
4 // know that `T: 'a`.
5
6 trait MyTrait<'a> {
7     type Output;
8 }
9
10 fn foo<'a, T>() -> &'a ()
11 where
12     T: MyTrait<'a>,
13 {
14     bar::<T::Output>() //~ ERROR the parameter type `T` may not live long enough
15 }
16
17 fn bar<'a, T>() -> &'a ()
18 where
19     T: 'a,
20 {
21     &()
22 }
23
24 fn main() {}