]> git.lizzy.rs Git - rust.git/blob - src/test/ui/union/union-lint-dead-code.rs
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup
[rust.git] / src / test / ui / union / union-lint-dead-code.rs
1 #![deny(dead_code)]
2
3 union Foo {
4     x: usize,
5     b: bool, //~ ERROR: field is never read
6     _unused: u16,
7 }
8
9 fn field_read(f: Foo) -> usize {
10     unsafe { f.x }
11 }
12
13 fn main() {
14     let _ = field_read(Foo { x: 2 });
15 }