]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/type-check-pointer-coercions.stderr
Merge commit '645ef505da378b6f810b1567806d1bcc2856395f' into clippyup
[rust.git] / src / test / ui / nll / type-check-pointer-coercions.stderr
1 error: lifetime may not live long enough
2   --> $DIR/type-check-pointer-coercions.rs:4:5
3    |
4 LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 {
5    |                    --  -- lifetime `'b` defined here
6    |                    |
7    |                    lifetime `'a` defined here
8 LL |     x
9    |     ^ returning this value requires that `'a` must outlive `'b`
10    |
11    = help: consider adding the following bound: `'a: 'b`
12
13 error: lifetime may not live long enough
14   --> $DIR/type-check-pointer-coercions.rs:8:5
15    |
16 LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 {
17    |                    --  -- lifetime `'b` defined here
18    |                    |
19    |                    lifetime `'a` defined here
20 LL |     x
21    |     ^ returning this value requires that `'a` must outlive `'b`
22    |
23    = help: consider adding the following bound: `'a: 'b`
24
25 error: lifetime may not live long enough
26   --> $DIR/type-check-pointer-coercions.rs:13:5
27    |
28 LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 {
29    |                  --  -- lifetime `'b` defined here
30    |                  |
31    |                  lifetime `'a` defined here
32 LL |     // Two errors because *mut is invariant
33 LL |     x
34    |     ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
35    |
36    = help: consider adding the following bound: `'b: 'a`
37
38 error: lifetime may not live long enough
39   --> $DIR/type-check-pointer-coercions.rs:13:5
40    |
41 LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 {
42    |                  --  -- lifetime `'b` defined here
43    |                  |
44    |                  lifetime `'a` defined here
45 LL |     // Two errors because *mut is invariant
46 LL |     x
47    |     ^ returning this value requires that `'a` must outlive `'b`
48    |
49    = help: consider adding the following bound: `'a: 'b`
50
51 help: `'b` and `'a` must be the same: replace one with the other
52
53 error: lifetime may not live long enough
54   --> $DIR/type-check-pointer-coercions.rs:18:5
55    |
56 LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 {
57    |                 --  -- lifetime `'b` defined here
58    |                 |
59    |                 lifetime `'a` defined here
60 LL |     x
61    |     ^ returning this value requires that `'a` must outlive `'b`
62    |
63    = help: consider adding the following bound: `'a: 'b`
64
65 error: lifetime may not live long enough
66   --> $DIR/type-check-pointer-coercions.rs:24:5
67    |
68 LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 {
69    |               --  -- lifetime `'b` defined here
70    |               |
71    |               lifetime `'a` defined here
72 ...
73 LL |     y
74    |     ^ returning this value requires that `'a` must outlive `'b`
75    |
76    = help: consider adding the following bound: `'a: 'b`
77
78 error: lifetime may not live long enough
79   --> $DIR/type-check-pointer-coercions.rs:30:5
80    |
81 LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] {
82    |                 --  -- lifetime `'b` defined here
83    |                 |
84    |                 lifetime `'a` defined here
85 ...
86 LL |     y
87    |     ^ returning this value requires that `'a` must outlive `'b`
88    |
89    = help: consider adding the following bound: `'a: 'b`
90
91 error: lifetime may not live long enough
92   --> $DIR/type-check-pointer-coercions.rs:36:5
93    |
94 LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] {
95    |                 --  -- lifetime `'b` defined here
96    |                 |
97    |                 lifetime `'a` defined here
98 ...
99 LL |     y
100    |     ^ returning this value requires that `'a` must outlive `'b`
101    |
102    = help: consider adding the following bound: `'a: 'b`
103
104 error: aborting due to 8 previous errors
105