]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/type-check-pointer-comparisons.stderr
Rollup merge of #103644 - catlee:catlee/option-question-mark-docs, r=workingjubilee
[rust.git] / src / test / ui / nll / type-check-pointer-comparisons.stderr
1 error: lifetime may not live long enough
2   --> $DIR/type-check-pointer-comparisons.rs:4:5
3    |
4 LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) {
5    |                  --  -- lifetime `'b` defined here
6    |                  |
7    |                  lifetime `'a` defined here
8 LL |     x == y;
9    |     ^ requires that `'a` must outlive `'b`
10    |
11    = help: consider adding the following bound: `'a: 'b`
12    = note: requirement occurs because of a mutable reference to `&i32`
13    = note: mutable references are invariant over their type parameter
14    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
15
16 error: lifetime may not live long enough
17   --> $DIR/type-check-pointer-comparisons.rs:4:10
18    |
19 LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) {
20    |                  --  -- lifetime `'b` defined here
21    |                  |
22    |                  lifetime `'a` defined here
23 LL |     x == y;
24    |          ^ requires that `'b` must outlive `'a`
25    |
26    = help: consider adding the following bound: `'b: 'a`
27    = note: requirement occurs because of a mutable reference to `&i32`
28    = note: mutable references are invariant over their type parameter
29    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
30
31 help: `'a` and `'b` must be the same: replace one with the other
32
33 error: lifetime may not live long enough
34   --> $DIR/type-check-pointer-comparisons.rs:10:5
35    |
36 LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) {
37    |                --  -- lifetime `'b` defined here
38    |                |
39    |                lifetime `'a` defined here
40 LL |     x == y;
41    |     ^ requires that `'a` must outlive `'b`
42    |
43    = help: consider adding the following bound: `'a: 'b`
44    = note: requirement occurs because of a mutable pointer to `&i32`
45    = note: mutable pointers are invariant over their type parameter
46    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
47
48 error: lifetime may not live long enough
49   --> $DIR/type-check-pointer-comparisons.rs:10:10
50    |
51 LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) {
52    |                --  -- lifetime `'b` defined here
53    |                |
54    |                lifetime `'a` defined here
55 LL |     x == y;
56    |          ^ requires that `'b` must outlive `'a`
57    |
58    = help: consider adding the following bound: `'b: 'a`
59    = note: requirement occurs because of a mutable pointer to `&i32`
60    = note: mutable pointers are invariant over their type parameter
61    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
62
63 help: `'a` and `'b` must be the same: replace one with the other
64
65 error: lifetime may not live long enough
66   --> $DIR/type-check-pointer-comparisons.rs:16:5
67    |
68 LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) {
69    |                   --  -- lifetime `'b` defined here
70    |                   |
71    |                   lifetime `'a` defined here
72 LL |     f == g;
73    |     ^ requires that `'a` must outlive `'b`
74    |
75    = help: consider adding the following bound: `'a: 'b`
76    = note: requirement occurs because of a mutable reference to `&i32`
77    = note: mutable references are invariant over their type parameter
78    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
79
80 error: lifetime may not live long enough
81   --> $DIR/type-check-pointer-comparisons.rs:16:10
82    |
83 LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) {
84    |                   --  -- lifetime `'b` defined here
85    |                   |
86    |                   lifetime `'a` defined here
87 LL |     f == g;
88    |          ^ requires that `'b` must outlive `'a`
89    |
90    = help: consider adding the following bound: `'b: 'a`
91    = note: requirement occurs because of a mutable reference to `&i32`
92    = note: mutable references are invariant over their type parameter
93    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
94
95 help: `'a` and `'b` must be the same: replace one with the other
96
97 error: aborting due to 6 previous errors
98