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

static mut a: i32 = 15;

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

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