2019-04-22 02:40:08 -05:00
|
|
|
error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0`)
|
2018-12-19 13:58:20 -06:00
|
|
|
--> $DIR/union-borrow-move-parent-sibling.rs:53:13
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let a = &mut u.x.0;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ---------- mutable borrow occurs here (via `u.x.0`)
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let b = &u.y;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here
|
2018-11-04 11:36:30 -06:00
|
|
|
LL | use_borrow(a);
|
2019-04-22 02:40:08 -05:00
|
|
|
| - mutable borrow later used here
|
|
|
|
|
|
|
|
|
= note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0`
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0382]: use of moved value: `u`
|
2018-12-19 13:58:20 -06:00
|
|
|
--> $DIR/union-borrow-move-parent-sibling.rs:60:13
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-07-03 05:35:02 -05:00
|
|
|
LL | let u = U { x: ((MockVec::new(), MockVec::new()), MockVec::new()) };
|
2019-04-22 02:40:08 -05:00
|
|
|
| - move occurs because `u` has type `U`, which does not implement the `Copy` trait
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | let a = u.x.0;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- value moved here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let b = u.y;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^ value used here after move
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`)
|
2018-12-19 13:58:20 -06:00
|
|
|
--> $DIR/union-borrow-move-parent-sibling.rs:66:13
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let a = &mut (u.x.0).0;
|
2019-04-22 02:40:08 -05:00
|
|
|
| -------------- mutable borrow occurs here (via `u.x.0.0`)
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let b = &u.y;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here
|
2018-11-04 11:36:30 -06:00
|
|
|
LL | use_borrow(a);
|
2019-04-22 02:40:08 -05:00
|
|
|
| - mutable borrow later used here
|
|
|
|
|
|
|
|
|
= note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0.0`
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0382]: use of moved value: `u`
|
2018-12-19 13:58:20 -06:00
|
|
|
--> $DIR/union-borrow-move-parent-sibling.rs:73:13
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-07-03 05:35:02 -05:00
|
|
|
LL | let u = U { x: ((MockVec::new(), MockVec::new()), MockVec::new()) };
|
2019-04-22 02:40:08 -05:00
|
|
|
| - move occurs because `u` has type `U`, which does not implement the `Copy` trait
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | let a = (u.x.0).0;
|
2019-04-22 02:40:08 -05:00
|
|
|
| --------- value moved here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let b = u.y;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^ value used here after move
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-07-03 05:35:02 -05:00
|
|
|
error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`)
|
2018-12-19 13:58:20 -06:00
|
|
|
--> $DIR/union-borrow-move-parent-sibling.rs:79:13
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let a = &mut *u.y;
|
2019-07-03 05:35:02 -05:00
|
|
|
| --- mutable borrow occurs here (via `u.y`)
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let b = &u.x;
|
2019-07-03 05:35:02 -05:00
|
|
|
| ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here
|
2018-11-04 11:36:30 -06:00
|
|
|
LL | use_borrow(a);
|
2019-04-22 02:40:08 -05:00
|
|
|
| - mutable borrow later used here
|
|
|
|
|
|
2019-07-03 05:35:02 -05:00
|
|
|
= note: `u.x` is a field of the union `U`, so it overlaps the field `u.y`
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-07-03 05:35:02 -05:00
|
|
|
error: aborting due to 5 previous errors
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
Some errors have detailed explanations: E0382, E0502.
|
2018-08-08 07:28:26 -05:00
|
|
|
For more information about an error, try `rustc --explain E0382`.
|