rust/tests/ui/mir/validate/transmute_cast_sized.rs

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

18 lines
334 B
Rust
Raw Normal View History

//@ 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]);
};
}