aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/unsafe2.rs
blob: e03e4bc59f425dd644dfce2e99fe1caa35d552c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fn foo(_a: &i32) {}
fn bar(_a: i32) {}

mod inner {
    pub static mut a: i32 = 15;
}

fn main() {
    foo(&inner::a); // { dg-error "use of mutable static" }
    bar(inner::a); // { dg-error "use of mutable static" }

    unsafe {
        foo(&inner::a);
        bar(inner::a);
    }
}