]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-union-uninitialized.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / borrowck / borrowck-union-uninitialized.rs
1 struct S {
2     a: u8,
3 }
4
5 union U {
6     a: u8,
7 }
8
9 fn main() {
10     unsafe {
11         let mut s: S;
12         let mut u: U;
13         s.a = 0;
14         u.a = 0;
15         let sa = s.a; //~ ERROR use of possibly uninitialized variable: `s.a`
16         let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a`
17     }
18 }