| error: cannot infer an appropriate lifetime |
| --> $DIR/must_outlive_least_region_or_bound.rs:3:35 |
| | |
| LL | fn elided(x: &i32) -> impl Copy { x } |
| | --------- ^ ...but this borrow... |
| | | |
| | this return type evaluates to the `'static` lifetime... |
| | |
| note: ...can't outlive the anonymous lifetime #1 defined on the function body at 3:1 |
| --> $DIR/must_outlive_least_region_or_bound.rs:3:1 |
| | |
| LL | fn elided(x: &i32) -> impl Copy { x } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| help: you can add a constraint to the return type to make it last less than `'static` and match the anonymous lifetime #1 defined on the function body at 3:1 |
| | |
| LL | fn elided(x: &i32) -> impl Copy + '_ { x } |
| | ^^^^^^^^^^^^^^ |
| |
| error: cannot infer an appropriate lifetime |
| --> $DIR/must_outlive_least_region_or_bound.rs:6:44 |
| | |
| LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } |
| | --------- ^ ...but this borrow... |
| | | |
| | this return type evaluates to the `'static` lifetime... |
| | |
| note: ...can't outlive the lifetime `'a` as defined on the function body at 6:13 |
| --> $DIR/must_outlive_least_region_or_bound.rs:6:13 |
| | |
| LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } |
| | ^^ |
| help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime `'a` as defined on the function body at 6:13 |
| | |
| LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } |
| | ^^^^^^^^^^^^^^ |
| |
| error: cannot infer an appropriate lifetime |
| --> $DIR/must_outlive_least_region_or_bound.rs:12:69 |
| | |
| LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } |
| | -------------------------------- ^ ...but this borrow... |
| | | |
| | this return type evaluates to the `'static` lifetime... |
| | |
| note: ...can't outlive the lifetime `'a` as defined on the function body at 12:15 |
| --> $DIR/must_outlive_least_region_or_bound.rs:12:15 |
| | |
| LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } |
| | ^^ |
| help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime `'a` as defined on the function body at 12:15 |
| | |
| LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static + 'a { x } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| |
| error[E0623]: lifetime mismatch |
| --> $DIR/must_outlive_least_region_or_bound.rs:17:61 |
| | |
| LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { |
| | ------- ^^^^^^^^^^^^^^^^ |
| | | | |
| | | ...but data from `y` is returned here |
| | this parameter and the return type are declared with different lifetimes... |
| |
| error[E0310]: the parameter type `T` may not live long enough |
| --> $DIR/must_outlive_least_region_or_bound.rs:22:51 |
| | |
| LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static { |
| | -- ^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | help: consider adding an explicit lifetime bound `T: 'static`... |
| | |
| note: ...so that the type `T` will meet its required lifetime bounds |
| --> $DIR/must_outlive_least_region_or_bound.rs:22:51 |
| | |
| LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static { |
| | ^^^^^^^^^^^^^^^^^^^^ |
| |
| error: aborting due to 5 previous errors |
| |
| Some errors have detailed explanations: E0310, E0623. |
| For more information about an error, try `rustc --explain E0310`. |