rust/tests/run-pass/panic/transmute_fat2.rs
2019-12-02 16:04:31 +01:00

12 lines
255 B
Rust

fn main() {
#[cfg(target_pointer_width="64")]
let bad = unsafe {
std::mem::transmute::<u128, &[u8]>(42)
};
#[cfg(target_pointer_width="32")]
let bad = unsafe {
std::mem::transmute::<u64, &[u8]>(42)
};
bad[0];
}