mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +00:00
16 lines
245 B
Rust
16 lines
245 B
Rust
mod m {
|
|
pub union U {
|
|
pub a: u8,
|
|
pub(super) b: u8,
|
|
c: u8,
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let u = m::U { a: 10 };
|
|
|
|
let a = u.a; // OK
|
|
let b = u.b; // OK
|
|
let c = u.c; //~ ERROR field `c` of union `U` is private
|
|
}
|