1 error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2 --> $DIR/must_outlive_least_region_or_bound.rs:3:35
4 LL | fn elided(x: &i32) -> impl Copy { x }
7 | hidden type `&i32` captures the anonymous lifetime defined here
9 help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
11 LL | fn elided(x: &i32) -> impl Copy + '_ { x }
14 error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
15 --> $DIR/must_outlive_least_region_or_bound.rs:6:44
17 LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
20 | hidden type `&'a i32` captures the lifetime `'a` as defined here
22 help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
24 LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
27 error: lifetime may not live long enough
28 --> $DIR/must_outlive_least_region_or_bound.rs:9:46
30 LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
31 | - ^ returning this value requires that `'1` must outlive `'static`
33 | let's call the lifetime of this reference `'1`
35 = help: consider replacing `'1` with `'static`
37 error: lifetime may not live long enough
38 --> $DIR/must_outlive_least_region_or_bound.rs:11:55
40 LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
41 | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
43 = help: consider replacing `'a` with `'static`
45 error[E0621]: explicit lifetime required in the type of `x`
46 --> $DIR/must_outlive_least_region_or_bound.rs:13:41
48 LL | fn foo<'a>(x: &i32) -> impl Copy + 'a { x }
49 | ---- ^ lifetime `'a` required
51 | help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
53 error: lifetime may not live long enough
54 --> $DIR/must_outlive_least_region_or_bound.rs:24:55
56 LL | fn elided5(x: &i32) -> (Box<dyn Debug>, impl Debug) { (Box::new(x), x) }
57 | - ^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
59 | let's call the lifetime of this reference `'1`
61 error: lifetime may not live long enough
62 --> $DIR/must_outlive_least_region_or_bound.rs:29:69
64 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
65 | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
67 = help: consider replacing `'a` with `'static`
69 error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
70 --> $DIR/must_outlive_least_region_or_bound.rs:34:5
72 LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
73 | -- hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:34:5: 34:31]` captures the lifetime `'b` as defined here
74 LL | move |_| println!("{}", y)
75 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
77 help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
79 LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
82 error[E0310]: the parameter type `T` may not live long enough
83 --> $DIR/must_outlive_least_region_or_bound.rs:39:5
88 = help: consider adding an explicit lifetime bound `T: 'static`...
90 error: aborting due to 9 previous errors
92 Some errors have detailed explanations: E0310, E0621, E0700.
93 For more information about an error, try `rustc --explain E0310`.