os-rust/tests/ui/union/union-lint-dead-code.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
223 B
Rust
Raw Normal View History

2016-09-05 10:19:00 -07:00
#![deny(dead_code)]
union Foo {
x: usize,
b: bool, //~ ERROR: field `b` is never read
2016-09-05 10:19:00 -07:00
_unused: u16,
}
fn field_read(f: Foo) -> usize {
unsafe { f.x }
}
fn main() {
let _ = field_read(Foo { x: 2 });
}