blob: 8a84bd86ae559e2536806afc0860c5c57f25085e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
mod m {
pub union U {
pub a: u8,
pub(super) b: u8,
c: u8,
}
}
fn main() { unsafe {
let u = m::U { a: 0 }; // OK
let u = m::U { b: 0 }; // OK
let u = m::U { c: 0 }; //~ ERROR field `c` of union `U` is private
let m::U { a } = u; // OK
let m::U { b } = u; // OK
let m::U { c } = u; //~ ERROR field `c` of union `U` is private
}}
|