summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/issue-57100.stderr
blob: 523c3e8d0a2c20074e8a6d7a9455c193c61df702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
error[E0502]: cannot borrow `r.r2_union.f3_union` (via `r.r2_union.f3_union.s2_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f3_union.s1_leaf.l1_u8`)
  --> $DIR/issue-57100.rs:42:20
   |
LL |         let mref = &mut r.r2_union.f3_union.s1_leaf.l1_u8;
   |                    -------------------------------------- mutable borrow occurs here (via `r.r2_union.f3_union.s1_leaf.l1_u8`)
...
LL |         let nref = &r.r2_union.f3_union.s2_leaf.l1_u8;
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immutable borrow of `r.r2_union.f3_union.s2_leaf.l1_u8` -- which overlaps with `r.r2_union.f3_union.s1_leaf.l1_u8` -- occurs here
...
LL |         println!("{} {}", mref, nref)
   |                           ---- mutable borrow later used here
   |
   = note: `r.r2_union.f3_union.s2_leaf.l1_u8` is a field of the union `Second`, so it overlaps the field `r.r2_union.f3_union.s1_leaf.l1_u8`

error[E0502]: cannot borrow `r.r2_union` (via `r.r2_union.f1_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f2_leaf.l1_u8`)
  --> $DIR/issue-57100.rs:60:20
   |
LL |         let mref = &mut r.r2_union.f2_leaf.l1_u8;
   |                    ----------------------------- mutable borrow occurs here (via `r.r2_union.f2_leaf.l1_u8`)
...
LL |         let nref = &r.r2_union.f1_leaf.l1_u8;
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ immutable borrow of `r.r2_union.f1_leaf.l1_u8` -- which overlaps with `r.r2_union.f2_leaf.l1_u8` -- occurs here
...
LL |         println!("{} {}", mref, nref)
   |                           ---- mutable borrow later used here
   |
   = note: `r.r2_union.f1_leaf.l1_u8` is a field of the union `First`, so it overlaps the field `r.r2_union.f2_leaf.l1_u8`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0502`.