41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
|
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||
|
--> $DIR/borrowck-anon-fields-struct.rs:23:19
|
||
|
|
|
||
|
LL | Y(ref mut a, _) => a
|
||
|
| --------- mutable borrow occurs here
|
||
|
...
|
||
|
LL | let b = match y {
|
||
|
| ^ immutable borrow occurs here
|
||
|
...
|
||
|
LL | *a += 1;
|
||
|
| ------- borrow later used here
|
||
|
|
||
|
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||
|
--> $DIR/borrowck-anon-fields-struct.rs:38:19
|
||
|
|
|
||
|
LL | Y(ref mut a, _) => a
|
||
|
| --------- mutable borrow occurs here
|
||
|
...
|
||
|
LL | let b = match y {
|
||
|
| ^ immutable borrow occurs here
|
||
|
...
|
||
|
LL | *a += 1;
|
||
|
| ------- borrow later used here
|
||
|
|
||
|
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
|
||
|
--> $DIR/borrowck-anon-fields-struct.rs:39:11
|
||
|
|
|
||
|
LL | Y(ref mut a, _) => a
|
||
|
| --------- first mutable borrow occurs here
|
||
|
...
|
||
|
LL | Y(ref mut b, _) => b //~ ERROR cannot borrow
|
||
|
| ^^^^^^^^^ second mutable borrow occurs here
|
||
|
...
|
||
|
LL | *a += 1;
|
||
|
| ------- borrow later used here
|
||
|
|
||
|
error: aborting due to 3 previous errors
|
||
|
|
||
|
Some errors occurred: E0499, E0502.
|
||
|
For more information about an error, try `rustc --explain E0499`.
|