Code change:
review comments:
I've looked into this some - NLL misses three errors, all of the form u.yu.x`. In each of the three cases, there is a mutable borrow of some field of the union and then a shared borrow of some other field immediately following. The issue seems to be that the mutable borrow is killed straight away as it isn't used later - therefore not causing a conflict with the shared borrow. I'm inclined to think that this is fine - and that NLL is correct in having less errors here. However, we might want to update the test to use the first mutable borrow for each case in order to make the error happen and demonstrate the diagnostic - if this is the case, I've that we can open a PR for that will update the test. cc
I'm inclined to agree that this is an instance where the test was not robust and that we need to add uses of those first mutable borrows.
I've submitted a PR () that makes the test more robust.

Related discussion:
text: error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable <del> --> $DIR/union-borrow-move-parent-sibling.rs:23:14 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:25:14 </ins> | LL |     let a = &mut u.x.0; |                  ----- mutable borrow occurs here <del> LL |     let a = &u.y; //~ ERROR cannot borrow `u.y` </del> <ins> LL |     let b = &u.y; //~ ERROR cannot borrow `u.y` </ins> |              ^^^ immutable borrow occurs here <ins> LL |     use_borrow(a); </ins> LL | } | - mutable borrow ends here error[E0382]: use of moved value: `u.y` <del> --> $DIR/union-borrow-move-parent-sibling.rs:29:9 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:32:9 </ins> | LL |     let a = u.x.0; |         - value moved here <del> LL |     let a = u.y; //~ ERROR use of moved value: `u.y` </del> <ins> LL |     let b = u.y; //~ ERROR use of moved value: `u.y` </ins> |         ^ value used here after move | = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable <del> --> $DIR/union-borrow-move-parent-sibling.rs:35:14 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:38:14 </ins> | LL |     let a = &mut (u.x.0).0; |                  --------- mutable borrow occurs here <del> LL |     let a = &u.y; //~ ERROR cannot borrow `u.y` </del> <ins> LL |     let b = &u.y; //~ ERROR cannot borrow `u.y` </ins> |              ^^^ immutable borrow occurs here <ins> LL |     use_borrow(a); </ins> LL | } | - mutable borrow ends here error[E0382]: use of moved value: `u.y` <del> --> $DIR/union-borrow-move-parent-sibling.rs:41:9 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:45:9 </ins> | LL |     let a = (u.x.0).0; |         - value moved here <del> LL |     let a = u.y; //~ ERROR use of moved value: `u.y` </del> <ins> LL |     let b = u.y; //~ ERROR use of moved value: `u.y` </ins> |         ^ value used here after move | = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`) <del> --> $DIR/union-borrow-move-parent-sibling.rs:47:14 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:51:14 </ins> | LL |     let a = &mut *u.y; |                  ---- mutable borrow occurs here (via `*u.y`) <del> LL |     let a = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) </del> <ins> LL |     let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) </ins> |              ^^^ immutable borrow occurs here (via `u.x`) <ins> LL |     use_borrow(a); </ins> LL | } | - mutable borrow ends here error[E0382]: use of moved value: `u.x` <del> --> $DIR/union-borrow-move-parent-sibling.rs:53:9 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:58:9 </ins> | LL |     let a = *u.y; |         - value moved here <del> LL |     let a = u.x; //~ ERROR use of moved value: `u.x` </del> <ins> LL |     let b = u.x; //~ ERROR use of moved value: `u.x` </ins> |         ^ value used here after move | = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait