0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-24 18:21:15 +01:00
rust/tests/ui/union/union-lint-dead-code.rs
Matthew Jasper 982b49494e Remove revisions for THIR unsafeck
This is to make the diff when stabilizing it easier to review.
2024-01-05 09:30:27 +00:00

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 });
}