rust/src/test/ui/union/union-borrow-move-parent-sibling.stderr

68 lines
2.3 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable
2018-12-25 09:56:47 -06:00
--> $DIR/union-borrow-move-parent-sibling.rs:15:14
2018-08-08 07:28:26 -05:00
|
LL | let a = &mut u.x.0;
| ----- mutable borrow occurs here
2019-03-09 06:03:44 -06:00
LL | let b = &u.y;
2018-08-08 07:28:26 -05:00
| ^^^ immutable borrow occurs here
LL | use_borrow(a);
2018-08-08 07:28:26 -05:00
LL | }
| - mutable borrow ends here
error[E0382]: use of moved value: `u.y`
2018-12-25 09:56:47 -06:00
--> $DIR/union-borrow-move-parent-sibling.rs:22:9
2018-08-08 07:28:26 -05:00
|
LL | let a = u.x.0;
| - value moved here
2019-03-09 06:03:44 -06:00
LL | let b = u.y;
2018-08-08 07:28:26 -05:00
| ^ value used here after move
|
= note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable
2018-12-25 09:56:47 -06:00
--> $DIR/union-borrow-move-parent-sibling.rs:28:14
2018-08-08 07:28:26 -05:00
|
LL | let a = &mut (u.x.0).0;
| --------- mutable borrow occurs here
2019-03-09 06:03:44 -06:00
LL | let b = &u.y;
2018-08-08 07:28:26 -05:00
| ^^^ immutable borrow occurs here
LL | use_borrow(a);
2018-08-08 07:28:26 -05:00
LL | }
| - mutable borrow ends here
error[E0382]: use of moved value: `u.y`
2018-12-25 09:56:47 -06:00
--> $DIR/union-borrow-move-parent-sibling.rs:35:9
2018-08-08 07:28:26 -05:00
|
LL | let a = (u.x.0).0;
| - value moved here
2019-03-09 06:03:44 -06:00
LL | let b = u.y;
2018-08-08 07:28:26 -05:00
| ^ value used here after move
|
= note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`)
2018-12-25 09:56:47 -06:00
--> $DIR/union-borrow-move-parent-sibling.rs:41:14
2018-08-08 07:28:26 -05:00
|
LL | let a = &mut *u.y;
| ---- mutable borrow occurs here (via `*u.y`)
2019-03-09 06:03:44 -06:00
LL | let b = &u.x;
| ^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here
LL | use_borrow(a);
2018-08-08 07:28:26 -05:00
LL | }
| - mutable borrow ends here
error[E0382]: use of moved value: `u.x`
2018-12-25 09:56:47 -06:00
--> $DIR/union-borrow-move-parent-sibling.rs:48:9
2018-08-08 07:28:26 -05:00
|
LL | let a = *u.y;
| - value moved here
2019-03-09 06:03:44 -06:00
LL | let b = u.x;
2018-08-08 07:28:26 -05:00
| ^ value used here after move
|
= note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait
error: aborting due to 6 previous errors
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`.