]> git.lizzy.rs Git - rust.git/blob - src/test/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr
Auto merge of #86873 - nikic:opaque-ptrs, r=nagisa
[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.0`)
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.0`)
6 LL |     let b = &u.y;
7    |             ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- 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.0`
12
13 error[E0382]: use of moved value: `u`
14   --> $DIR/union-borrow-move-parent-sibling.rs:63:13
15    |
16 LL |     let u = U { x: ((MockVec::new(), MockVec::new()), MockVec::new()) };
17    |         - move occurs because `u` has type `U`, which does not implement the `Copy` trait
18 LL |     let a = u.x.0;
19    |             ----- value moved here
20 LL |     let b = u.y;
21    |             ^^^ value used here after move
22
23 error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`)
24   --> $DIR/union-borrow-move-parent-sibling.rs:69:13
25    |
26 LL |     let a = &mut (u.x.0).0;
27    |             -------------- mutable borrow occurs here (via `u.x.0.0`)
28 LL |     let b = &u.y;
29    |             ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here
30 LL |     use_borrow(a);
31    |                - mutable borrow later used here
32    |
33    = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0.0`
34
35 error[E0382]: use of moved value: `u`
36   --> $DIR/union-borrow-move-parent-sibling.rs:76:13
37    |
38 LL |     let u = U { x: ((MockVec::new(), MockVec::new()), MockVec::new()) };
39    |         - move occurs because `u` has type `U`, which does not implement the `Copy` trait
40 LL |     let a = (u.x.0).0;
41    |             --------- value moved here
42 LL |     let b = u.y;
43    |             ^^^ value used here after move
44
45 error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`)
46   --> $DIR/union-borrow-move-parent-sibling.rs:82:13
47    |
48 LL |     let a = &mut *u.y;
49    |                   --- mutable borrow occurs here (via `u.y`)
50 LL |     let b = &u.x;
51    |             ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here
52 LL |     use_borrow(a);
53    |                - mutable borrow later used here
54    |
55    = note: `u.x` is a field of the union `U`, so it overlaps the field `u.y`
56
57 error: aborting due to 5 previous errors
58
59 Some errors have detailed explanations: E0382, E0502.
60 For more information about an error, try `rustc --explain E0382`.