Closed
Description
Miri doesn't complain about the following code, but is this guaranteed to be sound?
fn main() {
let x = UnsafeCell::new([0u8; 2]);
let x = &x;
let x_ptr: *const UnsafeCell<[u8; 2]> = x;
let y_ptr = x_ptr as *const [UnsafeCell<u8>; 2];
let _y = unsafe { &*y_ptr };
}
I read #451 (comment) as implying this is intended to be sound, but I wanted to double-check.
Metadata
Metadata
Assignees
Labels
No labels