2016-08-22 11:56:14 -05:00
|
|
|
mod m {
|
|
|
|
pub union U {
|
2016-08-26 11:23:42 -05:00
|
|
|
pub a: u8,
|
|
|
|
pub(super) b: u8,
|
|
|
|
c: u8,
|
2016-08-22 11:56:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-16 13:19:24 -05:00
|
|
|
fn main() { unsafe {
|
2016-08-26 11:23:42 -05:00
|
|
|
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 `m::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 `m::U` is private
|
2017-04-16 13:19:24 -05:00
|
|
|
}}
|