fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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