mirror of
https://github.com/rust-lang/rust
synced 2024-09-06 01:11:17 +00:00
16 lines
223 B
Rust
16 lines
223 B
Rust
#![deny(dead_code)]
|
|
|
|
union Foo {
|
|
x: usize,
|
|
b: bool, //~ ERROR: field `b` is never read
|
|
_unused: u16,
|
|
}
|
|
|
|
fn field_read(f: Foo) -> usize {
|
|
unsafe { f.x }
|
|
}
|
|
|
|
fn main() {
|
|
let _ = field_read(Foo { x: 2 });
|
|
}
|