summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/validate/transmute_cast_sized.rs
blob: eaaf7eb3ecd09bd5b2c48c616587e46efe738807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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]);
    };
}