Closed
Description
No matter what kind of const eval features we add, we should never allow this. Even if we managed to allow this, I think the current impl would ICE. Even if it does not ICE, it could never actually modify the memory. We should ensure that the following code always errors.
#![feature(const_raw_ptr_deref)]
#![feature(const_let)]
use std::cell::UnsafeCell;
struct Foo(UnsafeCell<u32>);
unsafe impl Send for Foo {}
unsafe impl Sync for Foo {}
static FOO: Foo = Foo(UnsafeCell::new(42));
static BAR: () = unsafe {
*FOO.0.get() = 5;
};
fn main() {
println!("{}", unsafe { *FOO.0.get() });
}