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