]>
Commit | Line | Data |
---|---|---|
48663c56 XL |
1 | error: lifetime may not live long enough |
2 | --> $DIR/must_outlive_least_region_or_bound.rs:3:23 | |
3 | | | |
4 | LL | fn elided(x: &i32) -> impl Copy { x } | |
5 | | - ^^^^^^^^^ opaque type requires that `'1` must outlive `'static` | |
6 | | | | |
7 | | let's call the lifetime of this reference `'1` | |
e74abb32 | 8 | | |
dc9dc135 | 9 | help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a constraint |
48663c56 XL |
10 | | |
11 | LL | fn elided(x: &i32) -> impl Copy + '_ { x } | |
12 | | ^^^^^^^^^^^^^^ | |
13 | ||
14 | error: lifetime may not live long enough | |
15 | --> $DIR/must_outlive_least_region_or_bound.rs:6:32 | |
16 | | | |
17 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } | |
18 | | -- ^^^^^^^^^ opaque type requires that `'a` must outlive `'static` | |
19 | | | | |
20 | | lifetime `'a` defined here | |
e74abb32 | 21 | | |
dc9dc135 | 22 | help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint |
48663c56 XL |
23 | | |
24 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } | |
25 | | ^^^^^^^^^^^^^^ | |
26 | ||
27 | error: lifetime may not live long enough | |
28 | --> $DIR/must_outlive_least_region_or_bound.rs:12:69 | |
29 | | | |
30 | LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } | |
31 | | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` | |
32 | | | |
33 | = help: consider replacing `'a` with `'static` | |
34 | ||
35 | error: lifetime may not live long enough | |
36 | --> $DIR/must_outlive_least_region_or_bound.rs:17:61 | |
37 | | | |
38 | LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | |
39 | | -- -- lifetime `'b` defined here ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a` | |
40 | | | | |
41 | | lifetime `'a` defined here | |
42 | ||
43 | error[E0310]: the parameter type `T` may not live long enough | |
44 | --> $DIR/must_outlive_least_region_or_bound.rs:22:51 | |
45 | | | |
46 | LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static { | |
47 | | ^^^^^^^^^^^^^^^^^^^^ | |
48 | | | |
49 | = help: consider adding an explicit lifetime bound `T: 'static`... | |
50 | ||
51 | error: aborting due to 5 previous errors | |
52 | ||
53 | For more information about this error, try `rustc --explain E0310`. |