]> git.lizzy.rs Git - rust.git/blob - src/test/ui/did_you_mean/issue-39544.stderr
Rollup merge of #41135 - japaric:unstable-docs, r=steveklabnik
[rust.git] / src / test / ui / did_you_mean / issue-39544.stderr
1 error: cannot borrow immutable field `z.x` as mutable
2   --> $DIR/issue-39544.rs:21:18
3    |
4 20 |     let z = Z { x: X::Y };
5    |         - consider changing this to `mut z`
6 21 |     let _ = &mut z.x;
7    |                  ^^^ cannot mutably borrow immutable field
8
9 error: cannot borrow immutable field `self.x` as mutable
10   --> $DIR/issue-39544.rs:26:22
11    |
12 25 |     fn foo<'z>(&'z self) {
13    |                -------- use `&'z mut self` here to make mutable
14 26 |         let _ = &mut self.x;
15    |                      ^^^^^^ cannot mutably borrow immutable field
16
17 error: cannot borrow immutable field `self.x` as mutable
18   --> $DIR/issue-39544.rs:30:22
19    |
20 29 |     fn foo1(&self, other: &Z) {
21    |             ----- use `&mut self` here to make mutable
22 30 |         let _ = &mut self.x;
23    |                      ^^^^^^ cannot mutably borrow immutable field
24
25 error: cannot borrow immutable field `other.x` as mutable
26   --> $DIR/issue-39544.rs:31:22
27    |
28 29 |     fn foo1(&self, other: &Z) {
29    |                           -- use `&mut Z` here to make mutable
30 30 |         let _ = &mut self.x;
31 31 |         let _ = &mut other.x;
32    |                      ^^^^^^^ cannot mutably borrow immutable field
33
34 error: cannot borrow immutable field `self.x` as mutable
35   --> $DIR/issue-39544.rs:35:22
36    |
37 34 |     fn foo2<'a>(&'a self, other: &Z) {
38    |                 -------- use `&'a mut self` here to make mutable
39 35 |         let _ = &mut self.x;
40    |                      ^^^^^^ cannot mutably borrow immutable field
41
42 error: cannot borrow immutable field `other.x` as mutable
43   --> $DIR/issue-39544.rs:36:22
44    |
45 34 |     fn foo2<'a>(&'a self, other: &Z) {
46    |                                  -- use `&mut Z` here to make mutable
47 35 |         let _ = &mut self.x;
48 36 |         let _ = &mut other.x;
49    |                      ^^^^^^^ cannot mutably borrow immutable field
50
51 error: cannot borrow immutable field `self.x` as mutable
52   --> $DIR/issue-39544.rs:40:22
53    |
54 39 |     fn foo3<'a>(self: &'a Self, other: &Z) {
55    |                       -------- use `&'a mut Self` here to make mutable
56 40 |         let _ = &mut self.x;
57    |                      ^^^^^^ cannot mutably borrow immutable field
58
59 error: cannot borrow immutable field `other.x` as mutable
60   --> $DIR/issue-39544.rs:41:22
61    |
62 39 |     fn foo3<'a>(self: &'a Self, other: &Z) {
63    |                                        -- use `&mut Z` here to make mutable
64 40 |         let _ = &mut self.x;
65 41 |         let _ = &mut other.x;
66    |                      ^^^^^^^ cannot mutably borrow immutable field
67
68 error: cannot borrow immutable field `other.x` as mutable
69   --> $DIR/issue-39544.rs:45:22
70    |
71 44 |     fn foo4(other: &Z) {
72    |                    -- use `&mut Z` here to make mutable
73 45 |         let _ = &mut other.x;
74    |                      ^^^^^^^ cannot mutably borrow immutable field
75
76 error: cannot borrow immutable field `z.x` as mutable
77   --> $DIR/issue-39544.rs:51:18
78    |
79 50 | pub fn with_arg(z: Z, w: &Z) {
80    |                 - consider changing this to `mut z`
81 51 |     let _ = &mut z.x;
82    |                  ^^^ cannot mutably borrow immutable field
83
84 error: cannot borrow immutable field `w.x` as mutable
85   --> $DIR/issue-39544.rs:52:18
86    |
87 50 | pub fn with_arg(z: Z, w: &Z) {
88    |                          -- use `&mut Z` here to make mutable
89 51 |     let _ = &mut z.x;
90 52 |     let _ = &mut w.x;
91    |                  ^^^ cannot mutably borrow immutable field
92
93 error: cannot assign to immutable borrowed content `*x.0`
94   --> $DIR/issue-39544.rs:58:5
95    |
96 58 |     *x.0 = 1;
97    |     ^^^^^^^^ cannot borrow as mutable
98
99 error: aborting due to 12 previous errors
100