about summary refs log tree commit diff
path: root/tests/ui/error-codes/E0017.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/error-codes/E0017.rs')
-rw-r--r--tests/ui/error-codes/E0017.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/error-codes/E0017.rs b/tests/ui/error-codes/E0017.rs
new file mode 100644
index 00000000000..c211ad1a2f8
--- /dev/null
+++ b/tests/ui/error-codes/E0017.rs
@@ -0,0 +1,14 @@
+static X: i32 = 1;
+const C: i32 = 2;
+static mut M: i32 = 3;
+
+const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
+                                     //~| WARN taking a mutable
+static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658
+                                              //~| ERROR cannot borrow
+                                              //~| ERROR mutable references are not allowed
+
+static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
+                                              //~| WARN taking a mutable
+static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR mutable references are not
+fn main() {}