]> git.lizzy.rs Git - rust.git/blob - tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
[rust.git] / tests / ui / span / borrowck-borrow-overloaded-auto-deref-mut.stderr
1 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:53:24
3    |
4 LL |     let __isize = &mut x.y;
5    |                        ^ cannot borrow as mutable
6    |
7 help: consider changing this to be mutable
8    |
9 LL | fn deref_mut_field1(mut x: Own<Point>) {
10    |                     +++
11
12 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
13   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:65:10
14    |
15 LL |     &mut x.y
16    |          ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
17    |
18 help: consider changing this to be a mutable reference
19    |
20 LL | fn deref_extend_mut_field1(x: &mut Own<Point>) -> &mut isize {
21    |                               ~~~~~~~~~~~~~~~
22
23 error[E0499]: cannot borrow `*x` as mutable more than once at a time
24   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19
25    |
26 LL |     let _x = &mut x.x;
27    |                   - first mutable borrow occurs here
28 LL |     let _y = &mut x.y;
29    |                   ^ second mutable borrow occurs here
30 LL |     use_mut(_x);
31    |             -- first borrow later used here
32
33 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
34   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:5
35    |
36 LL |     x.y = 3;
37    |     ^ cannot borrow as mutable
38    |
39 help: consider changing this to be mutable
40    |
41 LL | fn assign_field1<'a>(mut x: Own<Point>) {
42    |                      +++
43
44 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
45   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:92:5
46    |
47 LL |     x.y = 3;
48    |     ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
49    |
50 help: consider changing this to be a mutable reference
51    |
52 LL | fn assign_field2<'a>(x: &'a mut Own<Point>) {
53    |                         ~~~~~~~~~~~~~~~~~~
54
55 error[E0499]: cannot borrow `*x` as mutable more than once at a time
56   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5
57    |
58 LL |     let _p: &mut Point = &mut **x;
59    |                                -- first mutable borrow occurs here
60 LL |     x.y = 3;
61    |     ^ second mutable borrow occurs here
62 LL |     use_mut(_p);
63    |             -- first borrow later used here
64
65 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
66   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5
67    |
68 LL |     x.set(0, 0);
69    |     ^^^^^^^^^^^ cannot borrow as mutable
70    |
71 help: consider changing this to be mutable
72    |
73 LL | fn deref_mut_method1(mut x: Own<Point>) {
74    |                      +++
75
76 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
77   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5
78    |
79 LL |     x.y_mut()
80    |     ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
81    |
82 help: consider changing this to be a mutable reference
83    |
84 LL | fn deref_extend_mut_method1(x: &mut Own<Point>) -> &mut isize {
85    |                                ~~~~~~~~~~~~~~~
86
87 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
88   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6
89    |
90 LL |     *x.y_mut() = 3;
91    |      ^^^^^^^^^ cannot borrow as mutable
92    |
93 help: consider changing this to be mutable
94    |
95 LL | fn assign_method1<'a>(mut x: Own<Point>) {
96    |                       +++
97
98 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
99   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6
100    |
101 LL |     *x.y_mut() = 3;
102    |      ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
103    |
104 help: consider changing this to be a mutable reference
105    |
106 LL | fn assign_method2<'a>(x: &'a mut Own<Point>) {
107    |                          ~~~~~~~~~~~~~~~~~~
108
109 error: aborting due to 10 previous errors
110
111 Some errors have detailed explanations: E0499, E0596.
112 For more information about an error, try `rustc --explain E0499`.