fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
4.6 KiB101 linesraw
1error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
2  --> $DIR/issue-39544.rs:11:13
3   |
4LL |     let z = Z { x: X::Y };
5   |         - help: consider changing this to be mutable: `mut z`
6LL |     let _ = &mut z.x;
7   |             ^^^^^^^^ cannot borrow as mutable
8
9error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
10  --> $DIR/issue-39544.rs:16:17
11   |
12LL |     fn foo<'z>(&'z self) {
13   |                -------- help: consider changing this to be a mutable reference: `&'z mut self`
14LL |         let _ = &mut self.x;
15   |                 ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
16
17error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
18  --> $DIR/issue-39544.rs:20:17
19   |
20LL |     fn foo1(&self, other: &Z) {
21   |             ----- help: consider changing this to be a mutable reference: `&mut self`
22LL |         let _ = &mut self.x;
23   |                 ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
24
25error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
26  --> $DIR/issue-39544.rs:21:17
27   |
28LL |     fn foo1(&self, other: &Z) {
29   |                           -- help: consider changing this to be a mutable reference: `&mut Z`
30LL |         let _ = &mut self.x;
31LL |         let _ = &mut other.x;
32   |                 ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
33
34error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
35  --> $DIR/issue-39544.rs:25:17
36   |
37LL |     fn foo2<'a>(&'a self, other: &Z) {
38   |                 -------- help: consider changing this to be a mutable reference: `&'a mut self`
39LL |         let _ = &mut self.x;
40   |                 ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
41
42error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
43  --> $DIR/issue-39544.rs:26:17
44   |
45LL |     fn foo2<'a>(&'a self, other: &Z) {
46   |                                  -- help: consider changing this to be a mutable reference: `&mut Z`
47LL |         let _ = &mut self.x;
48LL |         let _ = &mut other.x;
49   |                 ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
50
51error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
52  --> $DIR/issue-39544.rs:30:17
53   |
54LL |     fn foo3<'a>(self: &'a Self, other: &Z) {
55   |                       -------- help: consider changing this to be a mutable reference: `&'a mut Self`
56LL |         let _ = &mut self.x;
57   |                 ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
58
59error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
60  --> $DIR/issue-39544.rs:31:17
61   |
62LL |     fn foo3<'a>(self: &'a Self, other: &Z) {
63   |                                        -- help: consider changing this to be a mutable reference: `&mut Z`
64LL |         let _ = &mut self.x;
65LL |         let _ = &mut other.x;
66   |                 ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
67
68error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
69  --> $DIR/issue-39544.rs:35:17
70   |
71LL |     fn foo4(other: &Z) {
72   |                    -- help: consider changing this to be a mutable reference: `&mut Z`
73LL |         let _ = &mut other.x;
74   |                 ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
75
76error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
77  --> $DIR/issue-39544.rs:41:13
78   |
79LL | pub fn with_arg(z: Z, w: &Z) {
80   |                 - help: consider changing this to be mutable: `mut z`
81LL |     let _ = &mut z.x;
82   |             ^^^^^^^^ cannot borrow as mutable
83
84error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference
85  --> $DIR/issue-39544.rs:42:13
86   |
87LL | pub fn with_arg(z: Z, w: &Z) {
88   |                          -- help: consider changing this to be a mutable reference: `&mut Z`
89LL |     let _ = &mut z.x;
90LL |     let _ = &mut w.x;
91   |             ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable
92
93error[E0594]: cannot assign to `*x.0` which is behind a `&` reference
94  --> $DIR/issue-39544.rs:48:5
95   |
96LL |     *x.0 = 1;
97   |     ^^^^^^^^ cannot assign
98
99error: aborting due to 12 previous errors
100
101For more information about this error, try `rustc --explain E0596`.