@@ -9,69 +9,90 @@ LL | let _ = &mut z.x;
99error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
1010 --> $DIR/issue-39544.rs:16:17
1111 |
12- LL | fn foo<'z>(&'z self) {
13- | -------- help: consider changing this to be a mutable reference: `&'z mut self`
1412LL | let _ = &mut self.x;
1513 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
14+ |
15+ help: consider changing this to be a mutable reference
16+ |
17+ LL | fn foo<'z>(&'z mut self) {
18+ | ~~~~~~~~~~~~
1619
1720error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
1821 --> $DIR/issue-39544.rs:20:17
1922 |
20- LL | fn foo1(&self, other: &Z) {
21- | ----- help: consider changing this to be a mutable reference: `&mut self`
2223LL | let _ = &mut self.x;
2324 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
25+ |
26+ help: consider changing this to be a mutable reference
27+ |
28+ LL | fn foo1(&mut self, other: &Z) {
29+ | ~~~~~~~~~
2430
2531error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
2632 --> $DIR/issue-39544.rs:21:17
2733 |
28- LL | fn foo1(&self, other: &Z) {
29- | -- help: consider changing this to be a mutable reference: `&mut Z`
30- LL | let _ = &mut self.x;
3134LL | let _ = &mut other.x;
3235 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
36+ |
37+ help: consider changing this to be a mutable reference
38+ |
39+ LL | fn foo1(&self, other: &mut Z) {
40+ | ~~~~~~
3341
3442error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
3543 --> $DIR/issue-39544.rs:25:17
3644 |
37- LL | fn foo2<'a>(&'a self, other: &Z) {
38- | -------- help: consider changing this to be a mutable reference: `&'a mut self`
3945LL | let _ = &mut self.x;
4046 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
47+ |
48+ help: consider changing this to be a mutable reference
49+ |
50+ LL | fn foo2<'a>(&'a mut self, other: &Z) {
51+ | ~~~~~~~~~~~~
4152
4253error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
4354 --> $DIR/issue-39544.rs:26:17
4455 |
45- LL | fn foo2<'a>(&'a self, other: &Z) {
46- | -- help: consider changing this to be a mutable reference: `&mut Z`
47- LL | let _ = &mut self.x;
4856LL | let _ = &mut other.x;
4957 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
58+ |
59+ help: consider changing this to be a mutable reference
60+ |
61+ LL | fn foo2<'a>(&'a self, other: &mut Z) {
62+ | ~~~~~~
5063
5164error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
5265 --> $DIR/issue-39544.rs:30:17
5366 |
54- LL | fn foo3<'a>(self: &'a Self, other: &Z) {
55- | -------- help: consider changing this to be a mutable reference: `&'a mut Self`
5667LL | let _ = &mut self.x;
5768 | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
69+ |
70+ help: consider changing this to be a mutable reference
71+ |
72+ LL | fn foo3<'a>(self: &'a mut Self, other: &Z) {
73+ | ~~~~~~~~~~~~
5874
5975error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
6076 --> $DIR/issue-39544.rs:31:17
6177 |
62- LL | fn foo3<'a>(self: &'a Self, other: &Z) {
63- | -- help: consider changing this to be a mutable reference: `&mut Z`
64- LL | let _ = &mut self.x;
6578LL | let _ = &mut other.x;
6679 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
80+ |
81+ help: consider changing this to be a mutable reference
82+ |
83+ LL | fn foo3<'a>(self: &'a Self, other: &mut Z) {
84+ | ~~~~~~
6785
6886error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
6987 --> $DIR/issue-39544.rs:35:17
7088 |
71- LL | fn foo4(other: &Z) {
72- | -- help: consider changing this to be a mutable reference: `&mut Z`
7389LL | let _ = &mut other.x;
7490 | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
91+ |
92+ help: consider changing this to be a mutable reference
93+ |
94+ LL | fn foo4(other: &mut Z) {
95+ | ~~~~~~
7596
7697error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
7798 --> $DIR/issue-39544.rs:41:13
@@ -84,11 +105,13 @@ LL | let _ = &mut z.x;
84105error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference
85106 --> $DIR/issue-39544.rs:42:13
86107 |
87- LL | pub fn with_arg(z: Z, w: &Z) {
88- | -- help: consider changing this to be a mutable reference: `&mut Z`
89- LL | let _ = &mut z.x;
90108LL | let _ = &mut w.x;
91109 | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable
110+ |
111+ help: consider changing this to be a mutable reference
112+ |
113+ LL | pub fn with_arg(z: Z, w: &mut Z) {
114+ | ~~~~~~
92115
93116error[E0594]: cannot assign to `*x.0`, which is behind a `&` reference
94117 --> $DIR/issue-39544.rs:48:5
0 commit comments