Skip to content

Commit bfc8ce3

Browse files
committed
Add a test for integer products
1 parent 5959a35 commit bfc8ce3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/test/ui/exhaustive_integer_patterns.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,10 @@ fn main() {
132132
128 ..= 255 if false => {}
133133
128 ..= 255 => {} // ok, because previous arm was guarded
134134
}
135+
136+
// Now things start getting a bit more interesting. Testing products!
137+
match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
138+
(1, _) => {}
139+
(_, None) => {}
140+
}
135141
}

src/test/ui/exhaustive_integer_patterns.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
5252
LL | match 0u8 { //~ ERROR non-exhaustive patterns
5353
| ^^^ pattern `128u8..=255u8` not covered
5454

55-
error: aborting due to 8 previous errors
55+
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
56+
--> $DIR/exhaustive_integer_patterns.rs:137:11
57+
|
58+
LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
59+
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
60+
61+
error: aborting due to 9 previous errors
5662

5763
For more information about this error, try `rustc --explain E0004`.

0 commit comments

Comments
 (0)