rust/tests/ui/consts/transmute-const.rs
2023-01-11 09:32:08 +00:00

13 lines
217 B
Rust

// run-pass
use std::mem;
#[repr(transparent)]
struct Foo(#[allow(unused_tuple_struct_fields)] u32);
const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) };
fn main() {
assert_eq!(TRANSMUTED_U32, 3);
}