]>
Commit | Line | Data |
---|---|---|
ff7c6d11 | 1 | #![allow(warnings)] |
ff7c6d11 XL |
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 | |
b7449926 | 10 | //~^ ERROR the parameter type `T` may not live long enough |
ff7c6d11 XL |
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 | |
b7449926 | 25 | //~^ ERROR the parameter type `T` may not live long enough |
ff7c6d11 XL |
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() {} |