]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/issue-57100.stderr
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / issue-57100.stderr
1 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`)
2   --> $DIR/issue-57100.rs:42:20
3    |
4 LL |         let mref = &mut r.r2_union.f3_union.s1_leaf.l1_u8;
5    |                    -------------------------------------- mutable borrow occurs here (via `r.r2_union.f3_union.s1_leaf.l1_u8`)
6 ...
7 LL |         let nref = &r.r2_union.f3_union.s2_leaf.l1_u8;
8    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
9 ...
10 LL |         println!("{} {}", mref, nref)
11    |                           ---- mutable borrow later used here
12    |
13    = 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`
14
15 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`)
16   --> $DIR/issue-57100.rs:60:20
17    |
18 LL |         let mref = &mut r.r2_union.f2_leaf.l1_u8;
19    |                    ----------------------------- mutable borrow occurs here (via `r.r2_union.f2_leaf.l1_u8`)
20 ...
21 LL |         let nref = &r.r2_union.f1_leaf.l1_u8;
22    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ immutable borrow of `r.r2_union.f1_leaf.l1_u8` -- which overlaps with `r.r2_union.f2_leaf.l1_u8` -- occurs here
23 ...
24 LL |         println!("{} {}", mref, nref)
25    |                           ---- mutable borrow later used here
26    |
27    = 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`
28
29 error: aborting due to 2 previous errors
30
31 For more information about this error, try `rustc --explain E0502`.