rust/tests/ui/mir/validate/transmute_cast_sized.rs
2023-04-09 18:16:05 -07:00

18 lines
331 B
Rust

// build-pass
// compile-flags: -Zvalidate-mir
// edition: 2021
#![crate_type = "lib"]
// Use `PhantomData` to get target-independent size
async fn get(_r: std::marker::PhantomData<&i32>) {
loop {}
}
pub fn check() {
let mut v = get(loop {});
let _ = || unsafe {
v = std::mem::transmute([0_u8; 1]);
};
}