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