]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-55651.rs
Rollup merge of #83807 - sjakobi:77548-remove-ignore-annotations, r=Mark-Simulacrum
[rust.git] / src / test / ui / nll / issue-55651.rs
1 // check-pass
2
3 #![feature(untagged_unions)]
4
5 struct A;
6 struct B;
7
8 union U {
9     a: A,
10     b: B,
11 }
12
13 fn main() {
14     unsafe {
15         {
16             let mut u = U { a: A };
17             let a = u.a;
18             u.a = A;
19             let a = u.a; // OK
20         }
21         {
22             let mut u = U { a: A };
23             let a = u.a;
24             u.b = B;
25             let a = u.a; // OK
26         }
27     }
28 }