1 error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
2 --> $DIR/issue-39544.rs:11:13
5 | ^^^^^^^^ cannot borrow as mutable
7 help: consider changing this to be mutable
9 LL | let mut z = Z { x: X::Y };
12 error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
13 --> $DIR/issue-39544.rs:16:17
15 LL | let _ = &mut self.x;
16 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
18 help: consider changing this to be a mutable reference
20 LL | fn foo<'z>(&'z mut self) {
23 error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
24 --> $DIR/issue-39544.rs:20:17
26 LL | let _ = &mut self.x;
27 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
29 help: consider changing this to be a mutable reference
31 LL | fn foo1(&mut self, other: &Z) {
34 error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
35 --> $DIR/issue-39544.rs:21:17
37 LL | let _ = &mut other.x;
38 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
40 help: consider changing this to be a mutable reference
42 LL | fn foo1(&self, other: &mut Z) {
45 error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
46 --> $DIR/issue-39544.rs:25:17
48 LL | let _ = &mut self.x;
49 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
51 help: consider changing this to be a mutable reference
53 LL | fn foo2<'a>(&'a mut self, other: &Z) {
56 error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
57 --> $DIR/issue-39544.rs:26:17
59 LL | let _ = &mut other.x;
60 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
62 help: consider changing this to be a mutable reference
64 LL | fn foo2<'a>(&'a self, other: &mut Z) {
67 error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
68 --> $DIR/issue-39544.rs:30:17
70 LL | let _ = &mut self.x;
71 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
73 help: consider changing this to be a mutable reference
75 LL | fn foo3<'a>(self: &'a mut Self, other: &Z) {
78 error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
79 --> $DIR/issue-39544.rs:31:17
81 LL | let _ = &mut other.x;
82 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
84 help: consider changing this to be a mutable reference
86 LL | fn foo3<'a>(self: &'a Self, other: &mut Z) {
89 error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
90 --> $DIR/issue-39544.rs:35:17
92 LL | let _ = &mut other.x;
93 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
95 help: consider changing this to be a mutable reference
97 LL | fn foo4(other: &mut Z) {
100 error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
101 --> $DIR/issue-39544.rs:41:13
103 LL | let _ = &mut z.x;
104 | ^^^^^^^^ cannot borrow as mutable
106 help: consider changing this to be mutable
108 LL | pub fn with_arg(mut z: Z, w: &Z) {
111 error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference
112 --> $DIR/issue-39544.rs:42:13
114 LL | let _ = &mut w.x;
115 | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable
117 help: consider changing this to be a mutable reference
119 LL | pub fn with_arg(z: Z, w: &mut Z) {
122 error[E0594]: cannot assign to `*x.0`, which is behind a `&` reference
123 --> $DIR/issue-39544.rs:48:5
126 | ^^^^^^^^ cannot assign
128 error: aborting due to 12 previous errors
130 Some errors have detailed explanations: E0594, E0596.
131 For more information about an error, try `rustc --explain E0594`.