about summary refs log tree commit diff
path: root/tests/ui/pattern/box-pattern-constructor-mismatch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/pattern/box-pattern-constructor-mismatch.rs')
-rw-r--r--tests/ui/pattern/box-pattern-constructor-mismatch.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/pattern/box-pattern-constructor-mismatch.rs b/tests/ui/pattern/box-pattern-constructor-mismatch.rs
new file mode 100644
index 00000000000..8f0a19d7407
--- /dev/null
+++ b/tests/ui/pattern/box-pattern-constructor-mismatch.rs
@@ -0,0 +1,11 @@
+//! Test that `box _` patterns and `Box { .. }` patterns can't be used to match on the same place.
+//! This is required for the current implementation of exhaustiveness analysis for deref patterns.
+
+#![feature(box_patterns)]
+
+fn main() {
+    match Box::new(0) {
+        box _ => {} //~ ERROR mix of deref patterns and normal constructors
+        Box { .. } => {}
+    }
+}