Skip to content

Commit 8389972

Browse files
committed
Add singleton patterns to test
1 parent a553fa7 commit 8389972

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/test/ui/exhaustive_integer_patterns.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
}
3535

3636
// An incomplete set of values.
37-
match x { //~ ERROR non-exhaustive patterns: `128u8...255u8` not covered
37+
match x { //~ ERROR non-exhaustive patterns
3838
0 .. 128 => {}
3939
}
4040

@@ -96,10 +96,19 @@ fn main() {
9696
-128 ..= 127 => {} // ok
9797
}
9898

99+
match 0i8 { //~ ERROR non-exhaustive patterns
100+
-127 ..= 127 => {}
101+
}
102+
99103
match 0i16 {
100104
i16::MIN ..= i16::MAX => {} // ok
101105
}
102106

107+
match 0i16 { //~ ERROR non-exhaustive patterns
108+
i16::MIN ..= -1 => {}
109+
1 ..= i16::MAX => {}
110+
}
111+
103112
match 0i32 {
104113
i32::MIN ..= i32::MAX => {} // ok
105114
}

src/test/ui/exhaustive_integer_patterns.stderr

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | #![deny(unreachable_patterns)]
1313
error[E0004]: non-exhaustive patterns: `128u8...255u8` not covered
1414
--> $DIR/exhaustive_integer_patterns.rs:37:11
1515
|
16-
LL | match x { //~ ERROR non-exhaustive patterns: `128u8...255u8` not covered
16+
LL | match x { //~ ERROR non-exhaustive patterns
1717
| ^ pattern `128u8...255u8` not covered
1818

1919
error[E0004]: non-exhaustive patterns: `11u8...19u8`, `31u8...34u8`, `36u8...69u8` and 1 more not covered
@@ -34,6 +34,18 @@ error[E0004]: non-exhaustive patterns: `-128i8...-6i8` and `122i8...127i8` not c
3434
LL | match x { //~ ERROR non-exhaustive patterns
3535
| ^ patterns `-128i8...-6i8` and `122i8...127i8` not covered
3636

37-
error: aborting due to 5 previous errors
37+
error[E0004]: non-exhaustive patterns: `-128i8` not covered
38+
--> $DIR/exhaustive_integer_patterns.rs:99:11
39+
|
40+
LL | match 0i8 { //~ ERROR non-exhaustive patterns
41+
| ^^^ pattern `-128i8` not covered
42+
43+
error[E0004]: non-exhaustive patterns: `0i16` not covered
44+
--> $DIR/exhaustive_integer_patterns.rs:107:11
45+
|
46+
LL | match 0i16 { //~ ERROR non-exhaustive patterns
47+
| ^^^^ pattern `0i16` not covered
48+
49+
error: aborting due to 7 previous errors
3850

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

0 commit comments

Comments
 (0)