]> git.lizzy.rs Git - rust.git/commitdiff
Add a test for integer products
authorvarkor <github@varkor.com>
Sun, 12 Aug 2018 19:47:23 +0000 (20:47 +0100)
committervarkor <github@varkor.com>
Thu, 16 Aug 2018 19:09:05 +0000 (20:09 +0100)
src/test/ui/exhaustive_integer_patterns.rs
src/test/ui/exhaustive_integer_patterns.stderr

index 294481389f7133ef89d8a1054c5caa9ee1bd56af..c267c4ef28c08f9ab527ca3b438295e315ba64fb 100644 (file)
@@ -132,4 +132,10 @@ fn main() {
         128 ..= 255 if false => {}
         128 ..= 255 => {} // ok, because previous arm was guarded
     }
+
+    // Now things start getting a bit more interesting. Testing products!
+    match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
+        (1, _) => {}
+        (_, None) => {}
+    }
 }
index a2ed9416b50bbce6200252f5981423a217bf7bbf..6fabbebf4875aaf7b18109b6b72f5f5262538209 100644 (file)
@@ -52,6 +52,12 @@ error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
 LL |     match 0u8 { //~ ERROR non-exhaustive patterns
    |           ^^^ pattern `128u8..=255u8` not covered
 
-error: aborting due to 8 previous errors
+error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
+  --> $DIR/exhaustive_integer_patterns.rs:137:11
+   |
+LL |     match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
+   |           ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
+
+error: aborting due to 9 previous errors
 
 For more information about this error, try `rustc --explain E0004`.