mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
78 lines
906 B
Rust
78 lines
906 B
Rust
#![feature(transparent_unions)]
|
|
#![warn(clippy::default_union_representation)]
|
|
|
|
union NoAttribute {
|
|
a: i32,
|
|
b: u32,
|
|
}
|
|
|
|
#[repr(C)]
|
|
union ReprC {
|
|
a: i32,
|
|
b: u32,
|
|
}
|
|
|
|
#[repr(packed)]
|
|
union ReprPacked {
|
|
a: i32,
|
|
b: u32,
|
|
}
|
|
|
|
#[repr(C, packed)]
|
|
union ReprCPacked {
|
|
a: i32,
|
|
b: u32,
|
|
}
|
|
|
|
#[repr(C, align(32))]
|
|
union ReprCAlign {
|
|
a: i32,
|
|
b: u32,
|
|
}
|
|
|
|
#[repr(align(32))]
|
|
union ReprAlign {
|
|
a: i32,
|
|
b: u32,
|
|
}
|
|
|
|
union SingleZST {
|
|
f0: (),
|
|
}
|
|
union ZSTsAndField1 {
|
|
f0: u32,
|
|
f1: (),
|
|
f2: (),
|
|
f3: (),
|
|
}
|
|
union ZSTsAndField2 {
|
|
f0: (),
|
|
f1: (),
|
|
f2: u32,
|
|
f3: (),
|
|
}
|
|
union ZSTAndTwoFields {
|
|
f0: u32,
|
|
f1: u64,
|
|
f2: (),
|
|
}
|
|
|
|
#[repr(C)]
|
|
union CZSTAndTwoFields {
|
|
f0: u32,
|
|
f1: u64,
|
|
f2: (),
|
|
}
|
|
|
|
#[repr(transparent)]
|
|
union ReprTransparent {
|
|
a: i32,
|
|
}
|
|
|
|
#[repr(transparent)]
|
|
union ReprTransparentZST {
|
|
a: i32,
|
|
b: (),
|
|
}
|
|
|
|
fn main() {}
|