about summary refs log tree commit diff
path: root/tests/ui/consts/const_in_pattern/incomplete-slice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/const_in_pattern/incomplete-slice.rs')
-rw-r--r--tests/ui/consts/const_in_pattern/incomplete-slice.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.rs b/tests/ui/consts/const_in_pattern/incomplete-slice.rs
new file mode 100644
index 00000000000..e1ccda71d40
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/incomplete-slice.rs
@@ -0,0 +1,15 @@
+#[derive(PartialEq)]
+enum E {
+    A,
+}
+
+const E_SL: &[E] = &[E::A];
+
+fn main() {
+    match &[][..] {
+        //~^ ERROR non-exhaustive patterns: `&_` not covered [E0004]
+        E_SL => {}
+        //~^ WARN to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]`
+        //~| WARN this was previously accepted by the compiler but is being phased out
+    }
+}