rust/tests/ui/consts/transmute-const.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
217 B
Rust
Raw Normal View History

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