rust/tests/ui/union/union-borrow-move-parent-sibling.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
3.4 KiB
Plaintext
Raw Normal View History

2022-06-30 02:33:18 +00:00
error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`)
--> $DIR/union-borrow-move-parent-sibling.rs:53:13
2018-08-08 12:28:26 +00:00
|
2022-06-30 02:33:18 +00:00
LL | let a = &mut (*u.x).0;
| --- mutable borrow occurs here (via `u.x`)
2019-03-09 12:03:44 +00:00
LL | let b = &u.y;
2022-06-30 02:33:18 +00:00
| ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here
LL | use_borrow(a);
| - mutable borrow later used here
|
2022-06-30 02:33:18 +00:00
= note: `u.y` is a field of the union `U`, so it overlaps the field `u.x`
error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, MockVec<u8>), MockVec<u8>)>`
--> $DIR/union-borrow-move-parent-sibling.rs:59:13
2022-06-30 02:33:18 +00:00
|
LL | let a = u.x.0;
| ^^^^^ move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait
|
help: consider borrowing here
|
LL | let a = &u.x.0;
| +
2018-08-08 12:28:26 +00:00
error[E0382]: use of moved value: `u`
--> $DIR/union-borrow-move-parent-sibling.rs:61:13
2018-08-08 12:28:26 +00:00
|
2022-06-30 02:33:18 +00:00
LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) };
| - move occurs because `u` has type `U`, which does not implement the `Copy` trait
2018-08-08 12:28:26 +00:00
LL | let a = u.x.0;
2022-06-30 02:33:18 +00:00
LL | let a = u.x;
| --- value moved here
2019-03-09 12:03:44 +00:00
LL | let b = u.y;
| ^^^ value used here after move
2018-08-08 12:28:26 +00:00
2022-06-30 02:33:18 +00:00
error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`)
--> $DIR/union-borrow-move-parent-sibling.rs:67:13
2018-08-08 12:28:26 +00:00
|
2022-06-30 02:33:18 +00:00
LL | let a = &mut ((*u.x).0).0;
| --- mutable borrow occurs here (via `u.x`)
2019-03-09 12:03:44 +00:00
LL | let b = &u.y;
2022-06-30 02:33:18 +00:00
| ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here
LL | use_borrow(a);
| - mutable borrow later used here
|
2022-06-30 02:33:18 +00:00
= note: `u.y` is a field of the union `U`, so it overlaps the field `u.x`
2018-08-08 12:28:26 +00:00
2022-06-30 02:33:18 +00:00
error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, MockVec<u8>), MockVec<u8>)>`
--> $DIR/union-borrow-move-parent-sibling.rs:73:13
2018-08-08 12:28:26 +00:00
|
2022-06-30 02:33:18 +00:00
LL | let a = (u.x.0).0;
| ^^^^^^^^^ move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait
|
help: consider borrowing here
|
LL | let a = &(u.x.0).0;
| +
2022-06-30 02:33:18 +00:00
error[E0382]: use of moved value: `u`
--> $DIR/union-borrow-move-parent-sibling.rs:75:13
2022-06-30 02:33:18 +00:00
|
LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) };
| - move occurs because `u` has type `U`, which does not implement the `Copy` trait
2018-08-08 12:28:26 +00:00
LL | let a = (u.x.0).0;
2022-06-30 02:33:18 +00:00
LL | let a = u.x;
| --- value moved here
2019-03-09 12:03:44 +00:00
LL | let b = u.y;
| ^^^ value used here after move
2018-08-08 12:28:26 +00:00
error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`)
--> $DIR/union-borrow-move-parent-sibling.rs:81:13
2018-08-08 12:28:26 +00:00
|
LL | let a = &mut *u.y;
| --- mutable borrow occurs here (via `u.y`)
2019-03-09 12:03:44 +00:00
LL | let b = &u.x;
| ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here
LL | use_borrow(a);
| - mutable borrow later used here
|
= note: `u.x` is a field of the union `U`, so it overlaps the field `u.y`
2018-08-08 12:28:26 +00:00
2022-06-30 02:33:18 +00:00
error: aborting due to 7 previous errors
2018-08-08 12:28:26 +00:00
2022-06-30 02:33:18 +00:00
Some errors have detailed explanations: E0382, E0502, E0507.
2018-08-08 12:28:26 +00:00
For more information about an error, try `rustc --explain E0382`.