Files
rust/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs
2025-04-08 23:06:31 +03:00

13 lines
298 B
Rust

// New test for #53818: modifying static memory at compile-time is not allowed.
// The test should never compile successfully
use std::cell::UnsafeCell;
static mut FOO: u32 = 42;
static BOO: () = unsafe {
FOO = 5;
//~^ ERROR could not evaluate static initializer [E0080]
};
fn main() {}