]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/type-check-pointer-coercions.stderr
fix merge conflicts
[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 error: lifetime may not live long enough
12   --> $DIR/type-check-pointer-coercions.rs:8:5
13    |
14 LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 {
15    |                    --  -- lifetime `'b` defined here
16    |                    |
17    |                    lifetime `'a` defined here
18 LL |     x
19    |     ^ returning this value requires that `'a` must outlive `'b`
20
21 error: lifetime may not live long enough
22   --> $DIR/type-check-pointer-coercions.rs:13:5
23    |
24 LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 {
25    |                  --  -- lifetime `'b` defined here
26    |                  |
27    |                  lifetime `'a` defined here
28 LL |     // Two errors because *mut is invariant
29 LL |     x
30    |     ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
31
32 error: lifetime may not live long enough
33   --> $DIR/type-check-pointer-coercions.rs:13:5
34    |
35 LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 {
36    |                  --  -- lifetime `'b` defined here
37    |                  |
38    |                  lifetime `'a` defined here
39 LL |     // Two errors because *mut is invariant
40 LL |     x
41    |     ^ returning this value requires that `'a` must outlive `'b`
42
43 error: lifetime may not live long enough
44   --> $DIR/type-check-pointer-coercions.rs:18:5
45    |
46 LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 {
47    |                 --  -- lifetime `'b` defined here
48    |                 |
49    |                 lifetime `'a` defined here
50 LL |     x
51    |     ^ returning this value requires that `'a` must outlive `'b`
52
53 error: lifetime may not live long enough
54   --> $DIR/type-check-pointer-coercions.rs:24:5
55    |
56 LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 {
57    |               --  -- lifetime `'b` defined here
58    |               |
59    |               lifetime `'a` defined here
60 ...
61 LL |     y
62    |     ^ returning this value requires that `'a` must outlive `'b`
63
64 error: lifetime may not live long enough
65   --> $DIR/type-check-pointer-coercions.rs:30:5
66    |
67 LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] {
68    |                 --  -- lifetime `'b` defined here
69    |                 |
70    |                 lifetime `'a` defined here
71 ...
72 LL |     y
73    |     ^ returning this value requires that `'a` must outlive `'b`
74
75 error: lifetime may not live long enough
76   --> $DIR/type-check-pointer-coercions.rs:36:5
77    |
78 LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] {
79    |                 --  -- lifetime `'b` defined here
80    |                 |
81    |                 lifetime `'a` defined here
82 ...
83 LL |     y
84    |     ^ returning this value requires that `'a` must outlive `'b`
85
86 error: aborting due to 8 previous errors
87