1 error: lifetime may not live long enough
2 --> $DIR/must_outlive_least_region_or_bound.rs:3:23
4 LL | fn elided(x: &i32) -> impl Copy { x }
5 | - ^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
7 | let's call the lifetime of this reference `'1`
9 help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a bound
11 LL | fn elided(x: &i32) -> impl Copy + '_ { x }
14 error: lifetime may not live long enough
15 --> $DIR/must_outlive_least_region_or_bound.rs:6:32
17 LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
18 | -- ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
20 | lifetime `'a` defined here
22 = help: consider replacing `'a` with `'static`
23 help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
25 LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
28 error: lifetime may not live long enough
29 --> $DIR/must_outlive_least_region_or_bound.rs:9:46
31 LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
32 | - ^ returning this value requires that `'1` must outlive `'static`
34 | let's call the lifetime of this reference `'1`
36 = help: consider replacing `'1` with `'static`
38 error: lifetime may not live long enough
39 --> $DIR/must_outlive_least_region_or_bound.rs:12:55
41 LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
42 | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
44 = help: consider replacing `'a` with `'static`
45 = help: consider replacing `'a` with `'static`
47 error[E0621]: explicit lifetime required in the type of `x`
48 --> $DIR/must_outlive_least_region_or_bound.rs:15:41
50 LL | fn foo<'a>(x: &i32) -> impl Copy + 'a { x }
51 | ---- ^ lifetime `'a` required
53 | help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
55 error: lifetime may not live long enough
56 --> $DIR/must_outlive_least_region_or_bound.rs:33:69
58 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
59 | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
61 = help: consider replacing `'a` with `'static`
62 = help: consider replacing `'a` with `'static`
64 error: lifetime may not live long enough
65 --> $DIR/must_outlive_least_region_or_bound.rs:38:61
67 LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
68 | -- -- lifetime `'b` defined here ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
70 | lifetime `'a` defined here
72 = help: consider adding the following bound: `'b: 'a`
74 error[E0310]: the parameter type `T` may not live long enough
75 --> $DIR/must_outlive_least_region_or_bound.rs:43:51
77 LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
78 | ^^^^^^^^^^^^^^^^^^^^
80 = help: consider adding an explicit lifetime bound `T: 'static`...
82 error: aborting due to 8 previous errors
84 Some errors have detailed explanations: E0310, E0621.
85 For more information about an error, try `rustc --explain E0310`.