Add a test for integer products

This commit is contained in:
varkor 2018-08-12 20:47:23 +01:00
parent 5959a358e4
commit bfc8ce36f8
2 changed files with 13 additions and 1 deletions

View 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) => {}
}
}

View 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`.