summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/borrowck-union-uninitialized.rs
blob: bbe9f22aac307c68a4ad094d2eba035a0902f589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
    }
}