]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/ty-outlives/impl-trait-outlives.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / ty-outlives / impl-trait-outlives.rs
1 // compile-flags:-Zverbose
2
3 #![allow(warnings)]
4
5 use std::fmt::Debug;
6
7 fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
8 where
9     T: Debug,
10 {
11     x
12     //~^ ERROR the parameter type `T` may not live long enough [E0309]
13 }
14
15 fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a
16 where
17     T: 'a + Debug,
18 {
19     x
20 }
21
22 fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
23 where
24     T: 'b + Debug,
25 {
26     x
27     //~^ ERROR the parameter type `T` may not live long enough [E0309]
28 }
29
30 fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
31 where
32     T: 'b + Debug,
33     'b: 'a,
34 {
35     x
36 }
37
38 fn main() {}