Closed
Description
Basically, is this UB?
use core::mem::MaybeUninit;
fn main() {
let mut x = MaybeUninit::<&'static u8>::uninit();
let xp = x.as_mut_ptr();
unsafe {
*xp = &0;
}
}
MIRI accepts it, but it also accepts this other one which I think is UB
use core::mem::MaybeUninit;
fn main() {
let mut x = MaybeUninit::<&'static u8>::uninit();
unsafe {
let xp = &mut*x.as_mut_ptr();
*xp = &0;
}
}
Metadata
Metadata
Assignees
Labels
No labels