summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/miri_unleashed/mutating_global.rs
blob: 231f4af0a20459c35131c5b0f2ae6d5f45ddd7d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// compile-flags: -Zunleash-the-miri-inside-of-you

// Make sure we cannot mutate globals.

static mut GLOBAL: i32 = 0;

static MUTATING_GLOBAL: () = {
    unsafe {
        GLOBAL = 99
        //~^ ERROR could not evaluate static initializer
        //~| NOTE modifying a static's initial value
    }
};

fn main() {}