Open
Description
use std::mem::transmute;
fn main() {
let r: &&u32 = unsafe {
let x = 42;
transmute(&&x)
};
// no UB detected
let f = || { let _ = **r; };
f();
// UB due to the inner deref
let _ = **r;
}
Found this when prompted by @Nadrieril:
In fact the other calls to
{try_}to_place
in match MIR lowering are potential places where we mess things up. E.g. here, we want to add aPlaceMention
to the scrutinee which we can't do if it's not captured, could that have weird consequences maybe?