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