|
| 1 | +error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable |
| 2 | + --> $DIR/union-borrow-move-parent-sibling.rs:25:13 |
| 3 | + | |
| 4 | +LL | let a = &mut u.x.0; |
| 5 | + | ---------- mutable borrow occurs here |
| 6 | +LL | let b = &u.y; //~ ERROR cannot borrow `u.y` |
| 7 | + | ^^^^ immutable borrow occurs here |
| 8 | +LL | use_borrow(a); |
| 9 | + | - mutable borrow later used here |
| 10 | + |
1 | 11 | error[E0382]: use of moved value: `u`
|
2 |
| - --> $DIR/union-borrow-move-parent-sibling.rs:29:13 |
| 12 | + --> $DIR/union-borrow-move-parent-sibling.rs:32:13 |
3 | 13 | |
|
4 | 14 | LL | let a = u.x.0;
|
5 | 15 | | ----- value moved here
|
6 |
| -LL | let a = u.y; //~ ERROR use of moved value: `u.y` |
| 16 | +LL | let b = u.y; //~ ERROR use of moved value: `u.y` |
7 | 17 | | ^^^ value used here after move
|
8 | 18 | |
|
9 | 19 | = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
|
10 | 20 |
|
| 21 | +error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable |
| 22 | + --> $DIR/union-borrow-move-parent-sibling.rs:38:13 |
| 23 | + | |
| 24 | +LL | let a = &mut (u.x.0).0; |
| 25 | + | -------------- mutable borrow occurs here |
| 26 | +LL | let b = &u.y; //~ ERROR cannot borrow `u.y` |
| 27 | + | ^^^^ immutable borrow occurs here |
| 28 | +LL | use_borrow(a); |
| 29 | + | - mutable borrow later used here |
| 30 | + |
11 | 31 | error[E0382]: use of moved value: `u`
|
12 |
| - --> $DIR/union-borrow-move-parent-sibling.rs:41:13 |
| 32 | + --> $DIR/union-borrow-move-parent-sibling.rs:45:13 |
13 | 33 | |
|
14 | 34 | LL | let a = (u.x.0).0;
|
15 | 35 | | --------- value moved here
|
16 |
| -LL | let a = u.y; //~ ERROR use of moved value: `u.y` |
| 36 | +LL | let b = u.y; //~ ERROR use of moved value: `u.y` |
17 | 37 | | ^^^ value used here after move
|
18 | 38 | |
|
19 | 39 | = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
|
20 | 40 |
|
| 41 | +error[E0502]: cannot borrow `u.x` as immutable because it is also borrowed as mutable |
| 42 | + --> $DIR/union-borrow-move-parent-sibling.rs:51:13 |
| 43 | + | |
| 44 | +LL | let a = &mut *u.y; |
| 45 | + | --------- mutable borrow occurs here |
| 46 | +LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) |
| 47 | + | ^^^^ immutable borrow occurs here |
| 48 | +LL | use_borrow(a); |
| 49 | + | - mutable borrow later used here |
| 50 | + |
21 | 51 | error[E0382]: use of moved value: `u`
|
22 |
| - --> $DIR/union-borrow-move-parent-sibling.rs:53:13 |
| 52 | + --> $DIR/union-borrow-move-parent-sibling.rs:58:13 |
23 | 53 | |
|
24 | 54 | LL | let a = *u.y;
|
25 | 55 | | ---- value moved here
|
26 |
| -LL | let a = u.x; //~ ERROR use of moved value: `u.x` |
| 56 | +LL | let b = u.x; //~ ERROR use of moved value: `u.x` |
27 | 57 | | ^^^ value used here after move
|
28 | 58 | |
|
29 | 59 | = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
|
30 | 60 |
|
31 |
| -error: aborting due to 3 previous errors |
| 61 | +error: aborting due to 6 previous errors |
32 | 62 |
|
33 |
| -For more information about this error, try `rustc --explain E0382`. |
| 63 | +Some errors occurred: E0382, E0502. |
| 64 | +For more information about an error, try `rustc --explain E0382`. |
0 commit comments