aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/unsafe1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/unsafe1.rs')
-rw-r--r--gcc/testsuite/rust/compile/unsafe1.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/unsafe1.rs b/gcc/testsuite/rust/compile/unsafe1.rs
new file mode 100644
index 0000000..9cd3f6b
--- /dev/null
+++ b/gcc/testsuite/rust/compile/unsafe1.rs
@@ -0,0 +1,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);
+ }
+}