| //! Test the behavior of moving out of non-`Copy` union fields. |
| //! Avoid types that `Drop`, we want to focus on moving. |
| #![feature(untagged_unions)] |
| // Moving out of a nocopy field prevents accessing other nocopy field. |
| move_out(x.f2_nocopy); //~ ERROR use of moved value: `x` |
| // "Moving" out of copy field doesn't prevent later field accesses. |
| move_out(x.f2_nocopy); // no error |
| // Moving out of a nocopy field prevents accessing other copy field. |
| move_out(x.f3_copy); //~ ERROR use of moved value: `x` |
| // Cannot move out of union that implements `Drop`. |
| move_out(x.f1_nocopy); //~ ERROR cannot move out of type `U2`, which implements the `Drop` |