Skip to content

Commit 527cccb

Browse files
committed
Add some more compound exhaustiveness tests
1 parent 9e9e023 commit 527cccb

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/test/ui/exhaustive_integer_patterns.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,17 @@ fn main() {
138138
(1, _) => {}
139139
(_, None) => {}
140140
}
141+
142+
match (0u8, true) { //~ ERROR non-exhaustive patterns
143+
(0..=125, false) => {}
144+
(128..=255, false) => {}
145+
(0..=255, true) => {}
146+
}
147+
148+
match (0u8, true) {
149+
(0..=125, false) => {}
150+
(128..=255, false) => {}
151+
(0..=255, true) => {}
152+
(125..128, false) => {}
153+
}
141154
}

src/test/ui/exhaustive_integer_patterns.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(
5858
LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
5959
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
6060

61-
error: aborting due to 9 previous errors
61+
error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered
62+
--> $DIR/exhaustive_integer_patterns.rs:142:11
63+
|
64+
LL | match (0u8, true) { //~ ERROR non-exhaustive patterns
65+
| ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered
66+
67+
error: aborting due to 10 previous errors
6268

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

0 commit comments

Comments
 (0)