about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmin Arria <arria.amin@gmail.com>2020-03-25 22:34:24 -0300
committerAmin Arria <arria.amin@gmail.com>2020-03-26 12:34:36 -0300
commitae7fa3042da8d432c6048b89d320c73e43615b97 (patch)
tree373d43f6f8af8806f7438a7f6c47d27df6374952
parent5796e6e4618fd02bb7423b8f1a62f5b01ada63a7 (diff)
downloadrust-ae7fa3042da8d432c6048b89d320c73e43615b97.tar.gz
rust-ae7fa3042da8d432c6048b89d320c73e43615b97.zip
Add tests based on issue #70372 comments
-rw-r--r--src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs b/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs
new file mode 100644
index 00000000000..eb6706e5000
--- /dev/null
+++ b/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+#![deny(unreachable_patterns)]
+
+#![feature(or_patterns)]
+fn main() {
+    match (3,42) {
+        (a,_) | (_,a) if a > 10 => {println!("{}", a)}
+        _ => ()
+    }
+
+    match Some((3,42)) {
+        Some((a, _)) | Some((_, a)) if a > 10 => {println!("{}", a)}
+        _ => ()
+
+    }
+
+    match Some((3,42)) {
+        Some((a, _) | (_, a)) if a > 10 => {println!("{}", a)}
+        _ => ()
+    }
+}