error[E0621]: explicit lifetime required in the type of `x` --> $DIR/must_outlive_least_region_or_bound.rs:13:35 | LL | fn elided(x: &i32) -> impl Copy { x } | ---- ^ lifetime `'static` required | | | help: add explicit lifetime `'static` to the type of `x`: `&'static i32` error: unsatisfied lifetime constraints --> $DIR/must_outlive_least_region_or_bound.rs:16:44 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint | LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } | ^^^^^^^^^^^^^^ error: unsatisfied lifetime constraints --> $DIR/must_outlive_least_region_or_bound.rs:22:69 | LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` | = help: consider replacing `'a` with `'static` error: unsatisfied lifetime constraints --> $DIR/must_outlive_least_region_or_bound.rs:29:5 | LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here LL | //~^ ERROR lifetime mismatch LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` error[E0310]: the parameter type `T` may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:32:51 | LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { | ^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'static`... error: aborting due to 5 previous errors Some errors occurred: E0310, E0621. For more information about an error, try `rustc --explain E0310`.