]> git.lizzy.rs Git - rust.git/blob - src/test/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr
Rollup merge of #100462 - zohnannor:master, r=thomcc
[rust.git] / src / test / ui / union / union-borrow-move-parent-sibling.thirunsafeck.stderr
1 error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`)
2   --> $DIR/union-borrow-move-parent-sibling.rs:56:13
3    |
4 LL |     let a = &mut (*u.x).0;
5    |                    --- mutable borrow occurs here (via `u.x`)
6 LL |     let b = &u.y;
7    |             ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here
8 LL |     use_borrow(a);
9    |                - mutable borrow later used here
10    |
11    = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x`
12
13 error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, MockVec<u8>), MockVec<u8>)>`
14   --> $DIR/union-borrow-move-parent-sibling.rs:62:13
15    |
16 LL |     let a = u.x.0;
17    |             ^^^^^
18    |             |
19    |             move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait
20    |             help: consider borrowing here: `&u.x.0`
21
22 error[E0382]: use of moved value: `u`
23   --> $DIR/union-borrow-move-parent-sibling.rs:64:13
24    |
25 LL |     let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) };
26    |         - move occurs because `u` has type `U`, which does not implement the `Copy` trait
27 LL |     let a = u.x.0;
28 LL |     let a = u.x;
29    |             --- value moved here
30 LL |     let b = u.y;
31    |             ^^^ value used here after move
32
33 error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`)
34   --> $DIR/union-borrow-move-parent-sibling.rs:70:13
35    |
36 LL |     let a = &mut ((*u.x).0).0;
37    |                     --- mutable borrow occurs here (via `u.x`)
38 LL |     let b = &u.y;
39    |             ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here
40 LL |     use_borrow(a);
41    |                - mutable borrow later used here
42    |
43    = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x`
44
45 error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, MockVec<u8>), MockVec<u8>)>`
46   --> $DIR/union-borrow-move-parent-sibling.rs:76:13
47    |
48 LL |     let a = (u.x.0).0;
49    |             ^^^^^^^^^
50    |             |
51    |             move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait
52    |             help: consider borrowing here: `&(u.x.0).0`
53
54 error[E0382]: use of moved value: `u`
55   --> $DIR/union-borrow-move-parent-sibling.rs:78:13
56    |
57 LL |     let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) };
58    |         - move occurs because `u` has type `U`, which does not implement the `Copy` trait
59 LL |     let a = (u.x.0).0;
60 LL |     let a = u.x;
61    |             --- value moved here
62 LL |     let b = u.y;
63    |             ^^^ value used here after move
64
65 error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`)
66   --> $DIR/union-borrow-move-parent-sibling.rs:84:13
67    |
68 LL |     let a = &mut *u.y;
69    |                   --- mutable borrow occurs here (via `u.y`)
70 LL |     let b = &u.x;
71    |             ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here
72 LL |     use_borrow(a);
73    |                - mutable borrow later used here
74    |
75    = note: `u.x` is a field of the union `U`, so it overlaps the field `u.y`
76
77 error: aborting due to 7 previous errors
78
79 Some errors have detailed explanations: E0382, E0502, E0507.
80 For more information about an error, try `rustc --explain E0382`.