blob: 68ccb51fcd0fb8403be644f930e97a1f198cc897 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// compile-flags:-Zverbose
#![allow(warnings)]
use std::fmt::Debug;
fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
where
T: Debug,
{
x
//~^ ERROR the parameter type `T` may not live long enough [E0309]
}
fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a
where
T: 'a + Debug,
{
x
}
fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
where
T: 'b + Debug,
{
x
//~^ ERROR the parameter type `T` may not live long enough [E0309]
}
fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
where
T: 'b + Debug,
'b: 'a,
{
x
}
fn main() {}
|