]> git.lizzy.rs Git - rust.git/blob - src/test/ui/did_you_mean/issue-39544.stderr
use structured suggestion for "missing mut" label
[rust.git] / src / test / ui / did_you_mean / issue-39544.stderr
1 error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
2   --> $DIR/issue-39544.rs:21:18
3    |
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
8
9 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
10   --> $DIR/issue-39544.rs:26:22
11    |
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
16
17 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
18   --> $DIR/issue-39544.rs:30:22
19    |
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
24
25 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
26   --> $DIR/issue-39544.rs:31:22
27    |
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
33
34 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
35   --> $DIR/issue-39544.rs:35:22
36    |
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
41
42 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
43   --> $DIR/issue-39544.rs:36:22
44    |
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
50
51 error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
52   --> $DIR/issue-39544.rs:40:22
53    |
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
58
59 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
60   --> $DIR/issue-39544.rs:41:22
61    |
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
67
68 error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
69   --> $DIR/issue-39544.rs:45:22
70    |
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
75
76 error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
77   --> $DIR/issue-39544.rs:51:18
78    |
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
83
84 error[E0596]: cannot borrow field `w.x` of immutable binding as mutable
85   --> $DIR/issue-39544.rs:52:18
86    |
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
92
93 error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding
94   --> $DIR/issue-39544.rs:58:5
95    |
96 LL |     *x.0 = 1;
97    |     ^^^^^^^^ cannot borrow as mutable
98
99 error: aborting due to 12 previous errors
100
101 Some errors occurred: E0594, E0596.
102 For more information about an error, try `rustc --explain E0594`.