rust/tests/ui/union/union-macro.rs
Arthur Carcano 701dd5bc9d Allow unused fields in some tests
The dead_code lint was previously eroneously missing those.
Since this lint bug has been fixed, the unused fields warnings need
to be fixed.

Most of them are marked as `#[allow(dead_code)]`. Other warnings are
fixed by changing visibility of modules.
2024-03-12 10:59:41 +01:00

27 lines
337 B
Rust

//@ run-pass
#![allow(unused_variables)]
macro_rules! duplicate {
($i: item) => {
mod m1 {
$i
}
mod m2 {
$i
}
}
}
duplicate! {
pub union U {
#[allow(dead_code)]
pub a: u8
}
}
fn main() {
let u1 = m1::U { a: 0 };
let u2 = m2::U { a: 0 };
}