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