rust/tests/ui/borrowck/borrowck-union-uninitialized.rs
2023-01-11 09:32:08 +00:00

19 lines
236 B
Rust

struct S {
a: u8,
}
union U {
a: u8,
}
fn main() {
unsafe {
let mut s: S;
let mut u: U;
s.a = 0; //~ ERROR E0381
u.a = 0; //~ ERROR E0381
let sa = s.a;
let ua = u.a;
}
}