about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2018-06-03 19:47:19 +0100
committerAlexander Regueiro <alexreg@me.com>2018-06-30 23:52:33 +0100
commit9e484720bfd0e6a34a9036341f426cf8884bcd63 (patch)
tree7950d28d68c0cb7f2bb9ff1a72db81ba9a895799 /src/test
parenta2cd95fd9ea3eb698dc9f8ae7dd29321e5345e96 (diff)
downloadrust-9e484720bfd0e6a34a9036341f426cf8884bcd63.tar.gz
rust-9e484720bfd0e6a34a9036341f426cf8884bcd63.zip
Added tests for writing to static mut's in statics.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/write-to-static-mut-in-static.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/compile-fail/write-to-static-mut-in-static.rs b/src/test/compile-fail/write-to-static-mut-in-static.rs
new file mode 100644
index 00000000000..1ea74f73723
--- /dev/null
+++ b/src/test/compile-fail/write-to-static-mut-in-static.rs
@@ -0,0 +1,22 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(const_let)]
+
+pub static mut A: u32 = 0;
+pub static mut B: () = unsafe { A = 1; };
+//~^ ERROR statements in statics are unstable
+
+pub static mut C: u32 = unsafe { C = 1; 0 };
+//~^ ERROR statements in statics are unstable
+
+pub static D: u32 = D;
+
+fn main() {}