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: <ins> error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable --> $DIR/union-borrow-move-parent-sibling.rs:25:13 | LL |     let a = &mut u.x.0; |             ---------- mutable borrow occurs here LL |     let b = &u.y; //~ ERROR cannot borrow `u.y` |             ^^^^ immutable borrow occurs here LL |     use_borrow(a); |                - mutable borrow later used here </ins> error[E0382]: use of moved value: `u` <del> --> $DIR/union-borrow-move-parent-sibling.rs:29:13 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:32:13 </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` has type `U`, which does not implement the `Copy` trait <ins> error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable --> $DIR/union-borrow-move-parent-sibling.rs:38:13 | LL |     let a = &mut (u.x.0).0; |             -------------- mutable borrow occurs here LL |     let b = &u.y; //~ ERROR cannot borrow `u.y` |             ^^^^ immutable borrow occurs here LL |     use_borrow(a); |                - mutable borrow later used here </ins> error[E0382]: use of moved value: `u` <del> --> $DIR/union-borrow-move-parent-sibling.rs:41:13 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:45:13 </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` has type `U`, which does not implement the `Copy` trait <ins> error[E0502]: cannot borrow `u.x` as immutable because it is also borrowed as mutable --> $DIR/union-borrow-move-parent-sibling.rs:51:13 | LL |     let a = &mut *u.y; |             --------- mutable borrow occurs here LL |     let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) |             ^^^^ immutable borrow occurs here LL |     use_borrow(a); |                - mutable borrow later used here </ins> error[E0382]: use of moved value: `u` <del> --> $DIR/union-borrow-move-parent-sibling.rs:53:13 </del> <ins> --> $DIR/union-borrow-move-parent-sibling.rs:58:13 </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` has type `U`, which does not implement the `Copy` trait <del> error: aborting due to 3 previous errors </del> <ins> error: aborting due to 6 previous errors </ins> <del> For more information about this error, try `rustc --explain E0382`. </del> <ins> Some errors occurred: E0382, E0502. For more information about an error, try `rustc --explain E0382`. </ins>