about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-08-14 03:02:31 +0100
committervarkor <github@varkor.com>2018-08-16 20:09:05 +0100
commit527cccb7a7a0213880eb97bd01ff1b9f3c834d5b (patch)
tree9d84b682b9245da5f3de736e4e9b7eb94ba74670
parent9e9e023354a0e9b93e342e5c3578e46c09e318f5 (diff)
downloadrust-527cccb7a7a0213880eb97bd01ff1b9f3c834d5b.tar.gz
rust-527cccb7a7a0213880eb97bd01ff1b9f3c834d5b.zip
Add some more compound exhaustiveness tests
-rw-r--r--src/test/ui/exhaustive_integer_patterns.rs13
-rw-r--r--src/test/ui/exhaustive_integer_patterns.stderr8
2 files changed, 20 insertions, 1 deletions
diff --git a/src/test/ui/exhaustive_integer_patterns.rs b/src/test/ui/exhaustive_integer_patterns.rs
index c267c4ef28c..0f8168cdd04 100644
--- a/src/test/ui/exhaustive_integer_patterns.rs
+++ b/src/test/ui/exhaustive_integer_patterns.rs
@@ -138,4 +138,17 @@ fn main() {
         (1, _) => {}
         (_, None) => {}
     }
+
+    match (0u8, true) { //~ ERROR non-exhaustive patterns
+        (0..=125, false) => {}
+        (128..=255, false) => {}
+        (0..=255, true) => {}
+    }
+
+    match (0u8, true) {
+        (0..=125, false) => {}
+        (128..=255, false) => {}
+        (0..=255, true) => {}
+        (125..128, false) => {}
+    }
 }
diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr
index 6fabbebf487..2222283247b 100644
--- a/src/test/ui/exhaustive_integer_patterns.stderr
+++ b/src/test/ui/exhaustive_integer_patterns.stderr
@@ -58,6 +58,12 @@ error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(
 LL |     match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
    |           ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
 
-error: aborting due to 9 previous errors
+error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered
+  --> $DIR/exhaustive_integer_patterns.rs:142:11
+   |
+LL |     match (0u8, true) { //~ ERROR non-exhaustive patterns
+   |           ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered
+
+error: aborting due to 10 previous errors
 
 For more information about this error, try `rustc --explain E0004`.