3 fn elided(x: &i32) -> impl Copy { x }
4 //~^ ERROR explicit lifetime required in the type of `x` [E0621]
6 fn explicit<'a>(x: &'a i32) -> impl Copy { x }
7 //~^ ERROR cannot infer an appropriate lifetime
9 trait LifetimeTrait<'a> {}
10 impl<'a> LifetimeTrait<'a> for &'a i32 {}
12 fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
13 //~^ ERROR cannot infer an appropriate lifetime
15 // Tests that a closure type contianing 'b cannot be returned from a type where
16 // only 'a was expected.
17 fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
18 //~^ ERROR lifetime mismatch
19 move |_| println!("{}", y)
22 fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
23 //~^ ERROR the parameter type `T` may not live long enough