error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:4:5 | LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:8:5 | LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:13:5 | LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here LL | // Two errors because *mut is invariant LL | x | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:13:5 | LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here LL | // Two errors because *mut is invariant LL | x | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` help: `'b` and `'a` must be the same: replace one with the other error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:18:5 | LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:24:5 | LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here ... LL | y | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:30:5 | LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here ... LL | y | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:36:5 | LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here ... LL | y | ^ returning this value requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: aborting due to 8 previous errors