]> git.proxmox.com Git - rustc.git/blame - src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
New upstream version 1.40.0+dfsg1
[rustc.git] / src / test / ui / impl-trait / must_outlive_least_region_or_bound.nll.stderr
CommitLineData
48663c56
XL
1error: lifetime may not live long enough
2 --> $DIR/must_outlive_least_region_or_bound.rs:3:23
3 |
4LL | 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 9help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a constraint
48663c56
XL
10 |
11LL | fn elided(x: &i32) -> impl Copy + '_ { x }
12 | ^^^^^^^^^^^^^^
13
14error: lifetime may not live long enough
15 --> $DIR/must_outlive_least_region_or_bound.rs:6:32
16 |
17LL | 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 22help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
48663c56
XL
23 |
24LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
25 | ^^^^^^^^^^^^^^
26
27error: lifetime may not live long enough
28 --> $DIR/must_outlive_least_region_or_bound.rs:12:69
29 |
30LL | 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
35error: lifetime may not live long enough
36 --> $DIR/must_outlive_least_region_or_bound.rs:17:61
37 |
38LL | 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
43error[E0310]: the parameter type `T` may not live long enough
44 --> $DIR/must_outlive_least_region_or_bound.rs:22:51
45 |
46LL | 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
51error: aborting due to 5 previous errors
52
53For more information about this error, try `rustc --explain E0310`.