fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.4 KiB84 linesraw
1error[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   |
4LL |     let a = &mut (*u.x).0;
5   |                    --- mutable borrow occurs here (via `u.x`)
6LL |     let b = &u.y;
7   |             ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here
8LL |     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
13error[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   |
16LL |     let a = u.x.0;
17   |             ^^^^^ move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait
18   |
19help: consider borrowing here
20   |
21LL |     let a = &u.x.0;
22   |             +
23
24error[E0382]: use of moved value: `u`
25  --> $DIR/union-borrow-move-parent-sibling.rs:64:13
26   |
27LL |     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
29LL |     let a = u.x.0;
30LL |     let a = u.x;
31   |             --- value moved here
32LL |     let b = u.y;
33   |             ^^^ value used here after move
34
35error[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   |
38LL |     let a = &mut ((*u.x).0).0;
39   |                     --- mutable borrow occurs here (via `u.x`)
40LL |     let b = &u.y;
41   |             ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here
42LL |     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
47error[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   |
50LL |     let a = (u.x.0).0;
51   |             ^^^^^^^^^ move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait
52   |
53help: consider borrowing here
54   |
55LL |     let a = &(u.x.0).0;
56   |             +
57
58error[E0382]: use of moved value: `u`
59  --> $DIR/union-borrow-move-parent-sibling.rs:78:13
60   |
61LL |     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
63LL |     let a = (u.x.0).0;
64LL |     let a = u.x;
65   |             --- value moved here
66LL |     let b = u.y;
67   |             ^^^ value used here after move
68
69error[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   |
72LL |     let a = &mut *u.y;
73   |                   --- mutable borrow occurs here (via `u.y`)
74LL |     let b = &u.x;
75   |             ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here
76LL |     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
81error: aborting due to 7 previous errors
82
83Some errors have detailed explanations: E0382, E0502, E0507.
84For more information about an error, try `rustc --explain E0382`.