summaryrefslogtreecommitdiffstats
path: root/src/test/ui/array-slice-vec/check-static-mut-slices.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/array-slice-vec/check-static-mut-slices.rs')
-rw-r--r--src/test/ui/array-slice-vec/check-static-mut-slices.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/check-static-mut-slices.rs b/src/test/ui/array-slice-vec/check-static-mut-slices.rs
new file mode 100644
index 000000000..b89c63403
--- /dev/null
+++ b/src/test/ui/array-slice-vec/check-static-mut-slices.rs
@@ -0,0 +1,15 @@
+// run-pass
+#![allow(dead_code)]
+
+// Checks that mutable static items can have mutable slices
+
+
+static mut TEST: &'static mut [isize] = &mut [1];
+static mut EMPTY: &'static mut [isize] = &mut [];
+
+pub fn main() {
+ unsafe {
+ TEST[0] += 1;
+ assert_eq!(TEST[0], 2);
+ }
+}