]>
git.proxmox.com Git - rustc.git/blob - tests/ui/consts/const-eval/mod-static-with-const-fn.rs
1 // New test for #53818: modifying static memory at compile-time is not allowed.
2 // The test should never compile successfully
4 #![feature(const_mut_refs)]
6 use std
::cell
::UnsafeCell
;
8 struct Foo(UnsafeCell
<u32>);
10 unsafe impl Send
for Foo {}
11 unsafe impl Sync
for Foo {}
13 static FOO
: Foo
= Foo(UnsafeCell
::new(42));
15 static BAR
: () = unsafe {
17 //~^ ERROR could not evaluate static initializer
21 println
!("{}", unsafe { *FOO.0.get() }
);