1 error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
2 --> $DIR/issue-39544.rs:21:18
4 LL | let z = Z { x: X::Y };
5 | - help: make this binding mutable: `mut z`
6 LL | let _ = &mut z.x; //~ ERROR cannot borrow
7 | ^^^ cannot mutably borrow field of immutable binding
9 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
10 --> $DIR/issue-39544.rs:26:22
12 LL | fn foo<'z>(&'z self) {
13 | -------- use `&'z mut self` here to make mutable
14 LL | let _ = &mut self.x; //~ ERROR cannot borrow
15 | ^^^^^^ cannot mutably borrow field of immutable binding
17 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
18 --> $DIR/issue-39544.rs:30:22
20 LL | fn foo1(&self, other: &Z) {
21 | ----- use `&mut self` here to make mutable
22 LL | let _ = &mut self.x; //~ ERROR cannot borrow
23 | ^^^^^^ cannot mutably borrow field of immutable binding
25 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
26 --> $DIR/issue-39544.rs:31:22
28 LL | fn foo1(&self, other: &Z) {
29 | -- use `&mut Z` here to make mutable
30 LL | let _ = &mut self.x; //~ ERROR cannot borrow
31 LL | let _ = &mut other.x; //~ ERROR cannot borrow
32 | ^^^^^^^ cannot mutably borrow field of immutable binding
34 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
35 --> $DIR/issue-39544.rs:35:22
37 LL | fn foo2<'a>(&'a self, other: &Z) {
38 | -------- use `&'a mut self` here to make mutable
39 LL | let _ = &mut self.x; //~ ERROR cannot borrow
40 | ^^^^^^ cannot mutably borrow field of immutable binding
42 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
43 --> $DIR/issue-39544.rs:36:22
45 LL | fn foo2<'a>(&'a self, other: &Z) {
46 | -- use `&mut Z` here to make mutable
47 LL | let _ = &mut self.x; //~ ERROR cannot borrow
48 LL | let _ = &mut other.x; //~ ERROR cannot borrow
49 | ^^^^^^^ cannot mutably borrow field of immutable binding
51 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
52 --> $DIR/issue-39544.rs:40:22
54 LL | fn foo3<'a>(self: &'a Self, other: &Z) {
55 | -------- use `&'a mut Self` here to make mutable
56 LL | let _ = &mut self.x; //~ ERROR cannot borrow
57 | ^^^^^^ cannot mutably borrow field of immutable binding
59 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
60 --> $DIR/issue-39544.rs:41:22
62 LL | fn foo3<'a>(self: &'a Self, other: &Z) {
63 | -- use `&mut Z` here to make mutable
64 LL | let _ = &mut self.x; //~ ERROR cannot borrow
65 LL | let _ = &mut other.x; //~ ERROR cannot borrow
66 | ^^^^^^^ cannot mutably borrow field of immutable binding
68 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
69 --> $DIR/issue-39544.rs:45:22
71 LL | fn foo4(other: &Z) {
72 | -- use `&mut Z` here to make mutable
73 LL | let _ = &mut other.x; //~ ERROR cannot borrow
74 | ^^^^^^^ cannot mutably borrow field of immutable binding
76 error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
77 --> $DIR/issue-39544.rs:51:18
79 LL | pub fn with_arg(z: Z, w: &Z) {
80 | - help: make this binding mutable: `mut z`
81 LL | let _ = &mut z.x; //~ ERROR cannot borrow
82 | ^^^ cannot mutably borrow field of immutable binding
84 error[E0596]: cannot borrow field `w.x` of immutable binding as mutable
85 --> $DIR/issue-39544.rs:52:18
87 LL | pub fn with_arg(z: Z, w: &Z) {
88 | -- use `&mut Z` here to make mutable
89 LL | let _ = &mut z.x; //~ ERROR cannot borrow
90 LL | let _ = &mut w.x; //~ ERROR cannot borrow
91 | ^^^ cannot mutably borrow field of immutable binding
93 error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding
94 --> $DIR/issue-39544.rs:58:5
97 | ^^^^^^^^ cannot borrow as mutable
99 error: aborting due to 12 previous errors
101 Some errors occurred: E0594, E0596.
102 For more information about an error, try `rustc --explain E0594`.