1 error: lifetime may not live long enough
2 --> $DIR/type-check-pointer-coercions.rs:4:5
4 LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 {
5 | -- -- lifetime `'b` defined here
7 | lifetime `'a` defined here
9 | ^ returning this value requires that `'a` must outlive `'b`
11 = help: consider adding the following bound: `'a: 'b`
13 error: lifetime may not live long enough
14 --> $DIR/type-check-pointer-coercions.rs:8:5
16 LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 {
17 | -- -- lifetime `'b` defined here
19 | lifetime `'a` defined here
21 | ^ returning this value requires that `'a` must outlive `'b`
23 = help: consider adding the following bound: `'a: 'b`
25 error: lifetime may not live long enough
26 --> $DIR/type-check-pointer-coercions.rs:13:5
28 LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 {
29 | -- -- lifetime `'b` defined here
31 | lifetime `'a` defined here
32 LL | // Two errors because *mut is invariant
34 | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
36 = help: consider adding the following bound: `'b: 'a`
38 error: lifetime may not live long enough
39 --> $DIR/type-check-pointer-coercions.rs:13:5
41 LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 {
42 | -- -- lifetime `'b` defined here
44 | lifetime `'a` defined here
45 LL | // Two errors because *mut is invariant
47 | ^ returning this value requires that `'a` must outlive `'b`
49 = help: consider adding the following bound: `'a: 'b`
51 help: `'b` and `'a` must be the same: replace one with the other
53 error: lifetime may not live long enough
54 --> $DIR/type-check-pointer-coercions.rs:18:5
56 LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 {
57 | -- -- lifetime `'b` defined here
59 | lifetime `'a` defined here
61 | ^ returning this value requires that `'a` must outlive `'b`
63 = help: consider adding the following bound: `'a: 'b`
65 error: lifetime may not live long enough
66 --> $DIR/type-check-pointer-coercions.rs:24:5
68 LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 {
69 | -- -- lifetime `'b` defined here
71 | lifetime `'a` defined here
74 | ^ returning this value requires that `'a` must outlive `'b`
76 = help: consider adding the following bound: `'a: 'b`
78 error: lifetime may not live long enough
79 --> $DIR/type-check-pointer-coercions.rs:30:5
81 LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] {
82 | -- -- lifetime `'b` defined here
84 | lifetime `'a` defined here
87 | ^ returning this value requires that `'a` must outlive `'b`
89 = help: consider adding the following bound: `'a: 'b`
91 error: lifetime may not live long enough
92 --> $DIR/type-check-pointer-coercions.rs:36:5
94 LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] {
95 | -- -- lifetime `'b` defined here
97 | lifetime `'a` defined here
100 | ^ returning this value requires that `'a` must outlive `'b`
102 = help: consider adding the following bound: `'a: 'b`
104 error: aborting due to 8 previous errors