11error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0`)
2- --> $DIR/union-borrow-move-parent-sibling.rs:15 :13
2+ --> $DIR/union-borrow-move-parent-sibling.rs:54 :13
33 |
44LL | let a = &mut u.x.0;
55 | ---------- mutable borrow occurs here (via `u.x.0`)
@@ -11,17 +11,17 @@ LL | use_borrow(a);
1111 = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0`
1212
1313error[E0382]: use of moved value: `u`
14- --> $DIR/union-borrow-move-parent-sibling.rs:22 :13
14+ --> $DIR/union-borrow-move-parent-sibling.rs:61 :13
1515 |
16- LL | let u = U { x: ((Vec ::new(), Vec ::new()), Vec ::new()) };
16+ LL | let u = U { x: ((MockVec ::new(), MockVec ::new()), MockVec ::new()) };
1717 | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
1818LL | let a = u.x.0;
1919 | ----- value moved here
2020LL | let b = u.y;
2121 | ^^^ value used here after move
2222
2323error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`)
24- --> $DIR/union-borrow-move-parent-sibling.rs:28 :13
24+ --> $DIR/union-borrow-move-parent-sibling.rs:67 :13
2525 |
2626LL | let a = &mut (u.x.0).0;
2727 | -------------- mutable borrow occurs here (via `u.x.0.0`)
@@ -33,38 +33,28 @@ LL | use_borrow(a);
3333 = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0.0`
3434
3535error[E0382]: use of moved value: `u`
36- --> $DIR/union-borrow-move-parent-sibling.rs:35 :13
36+ --> $DIR/union-borrow-move-parent-sibling.rs:74 :13
3737 |
38- LL | let u = U { x: ((Vec ::new(), Vec ::new()), Vec ::new()) };
38+ LL | let u = U { x: ((MockVec ::new(), MockVec ::new()), MockVec ::new()) };
3939 | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
4040LL | let a = (u.x.0).0;
4141 | --------- value moved here
4242LL | let b = u.y;
4343 | ^^^ value used here after move
4444
45- error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `* u.y`)
46- --> $DIR/union-borrow-move-parent-sibling.rs:41 :13
45+ error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`)
46+ --> $DIR/union-borrow-move-parent-sibling.rs:80 :13
4747 |
4848LL | let a = &mut *u.y;
49- | --------- mutable borrow occurs here (via `* u.y`)
49+ | --- mutable borrow occurs here (via `u.y`)
5050LL | let b = &u.x;
51- | ^^^^ immutable borrow of `u.x` -- which overlaps with `* u.y` -- occurs here
51+ | ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here
5252LL | use_borrow(a);
5353 | - mutable borrow later used here
5454 |
55- = note: `u.x` is a field of the union `U`, so it overlaps the field `* u.y`
55+ = note: `u.x` is a field of the union `U`, so it overlaps the field `u.y`
5656
57- error[E0382]: use of moved value: `u`
58- --> $DIR/union-borrow-move-parent-sibling.rs:48:13
59- |
60- LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
61- | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
62- LL | let a = *u.y;
63- | ---- value moved here
64- LL | let b = u.x;
65- | ^^^ value used here after move
66-
67- error: aborting due to 6 previous errors
57+ error: aborting due to 5 previous errors
6858
6959Some errors have detailed explanations: E0382, E0502.
7060For more information about an error, try `rustc --explain E0382`.
0 commit comments