error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
- --> $DIR/must_outlive_least_region_or_bound.rs:3:23
+ --> $DIR/must_outlive_least_region_or_bound.rs:3:35
|
LL | fn elided(x: &i32) -> impl Copy { x }
- | ---- ^^^^^^^^^
+ | ---- ^
| |
| hidden type `&i32` captures the anonymous lifetime defined here
|
| ++++
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
- --> $DIR/must_outlive_least_region_or_bound.rs:6:32
+ --> $DIR/must_outlive_least_region_or_bound.rs:6:44
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
- | -- ^^^^^^^^^
+ | -- ^
| |
| hidden type `&'a i32` captures the lifetime `'a` as defined here
|
| ~~~~~~~~~~~~
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
- --> $DIR/must_outlive_least_region_or_bound.rs:33:61
+ --> $DIR/must_outlive_least_region_or_bound.rs:34:5
|
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
- | -- ^^^^^^^^^^^^^^^^
- | |
- | hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
+ | -- hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:34:5: 34:31]` captures the lifetime `'b` as defined here
+LL | move |_| println!("{}", y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|