Skip to content

Commit 0fb52fb

Browse files
committed
Separate out precise_pointer_size_matching tests from exhaustive_integer_patterns tests
1 parent 4fc5758 commit 0fb52fb

4 files changed

+50
-17
lines changed

src/test/ui/exhaustive_integer_patterns.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#![deny(unreachable_patterns)]
1515

16-
use std::{char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128};
16+
use std::{char, u8, u16, u32, u64, u128, i8, i16, i32, i64, i128};
1717

1818
fn main() {
1919
let x: u8 = 0;
@@ -69,10 +69,6 @@ fn main() {
6969
'\u{E000}' ..= '\u{10_FFFF}' => {}
7070
}
7171

72-
match 0usize {
73-
0 ..= usize::MAX => {} // ok
74-
}
75-
7672
match 0u16 {
7773
0 ..= u16::MAX => {} // ok
7874
}
@@ -89,10 +85,6 @@ fn main() {
8985
0 ..= u128::MAX => {} // ok
9086
}
9187

92-
match 0isize {
93-
isize::MIN ..= isize::MAX => {} // ok
94-
}
95-
9688
match 0i8 {
9789
-128 ..= 127 => {} // ok
9890
}

src/test/ui/exhaustive_integer_patterns.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,49 +35,49 @@ LL | match x { //~ ERROR non-exhaustive patterns
3535
| ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
3636

3737
error[E0004]: non-exhaustive patterns: `-128i8` not covered
38-
--> $DIR/exhaustive_integer_patterns.rs:100:11
38+
--> $DIR/exhaustive_integer_patterns.rs:92:11
3939
|
4040
LL | match 0i8 { //~ ERROR non-exhaustive patterns
4141
| ^^^ pattern `-128i8` not covered
4242

4343
error[E0004]: non-exhaustive patterns: `0i16` not covered
44-
--> $DIR/exhaustive_integer_patterns.rs:108:11
44+
--> $DIR/exhaustive_integer_patterns.rs:100:11
4545
|
4646
LL | match 0i16 { //~ ERROR non-exhaustive patterns
4747
| ^^^^ pattern `0i16` not covered
4848

4949
error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
50-
--> $DIR/exhaustive_integer_patterns.rs:126:11
50+
--> $DIR/exhaustive_integer_patterns.rs:118:11
5151
|
5252
LL | match 0u8 { //~ ERROR non-exhaustive patterns
5353
| ^^^ pattern `128u8..=255u8` not covered
5454

5555
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
56-
--> $DIR/exhaustive_integer_patterns.rs:138:11
56+
--> $DIR/exhaustive_integer_patterns.rs:130:11
5757
|
5858
LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
5959
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
6060

6161
error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered
62-
--> $DIR/exhaustive_integer_patterns.rs:143:11
62+
--> $DIR/exhaustive_integer_patterns.rs:135:11
6363
|
6464
LL | match (0u8, true) { //~ ERROR non-exhaustive patterns
6565
| ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered
6666

6767
error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered
68-
--> $DIR/exhaustive_integer_patterns.rs:163:11
68+
--> $DIR/exhaustive_integer_patterns.rs:155:11
6969
|
7070
LL | match 0u128 { //~ ERROR non-exhaustive patterns
7171
| ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered
7272

7373
error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered
74-
--> $DIR/exhaustive_integer_patterns.rs:167:11
74+
--> $DIR/exhaustive_integer_patterns.rs:159:11
7575
|
7676
LL | match 0u128 { //~ ERROR non-exhaustive patterns
7777
| ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered
7878

7979
error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered
80-
--> $DIR/exhaustive_integer_patterns.rs:171:11
80+
--> $DIR/exhaustive_integer_patterns.rs:163:11
8181
|
8282
LL | match 0u128 { //~ ERROR non-exhaustive patterns
8383
| ^^^^^ pattern `0u128..=3u128` not covered
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(precise_pointer_size_matching)]
2+
#![feature(exclusive_range_pattern)]
3+
4+
#![deny(unreachable_patterns)]
5+
6+
use std::{usize, isize};
7+
8+
fn main() {
9+
match 0isize {
10+
isize::MIN ..= isize::MAX => {} // ok
11+
}
12+
13+
match 0usize {
14+
0 ..= usize::MAX => {} // ok
15+
}
16+
17+
match 0isize { //~ ERROR non-exhaustive patterns
18+
1 ..= 8 => {}
19+
-5 ..= 20 => {}
20+
}
21+
22+
match 0usize { //~ ERROR non-exhaustive patterns
23+
1 ..= 8 => {}
24+
5 ..= 20 => {}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0004]: non-exhaustive patterns: `-9223372036854775808isize..=-6isize` and `21isize..=9223372036854775807isize` not covered
2+
--> $DIR/precise_pointer_size_matching.rs:17:11
3+
|
4+
LL | match 0isize { //~ ERROR non-exhaustive patterns
5+
| ^^^^^^ patterns `-9223372036854775808isize..=-6isize` and `21isize..=9223372036854775807isize` not covered
6+
7+
error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=18446744073709551615usize` not covered
8+
--> $DIR/precise_pointer_size_matching.rs:22:11
9+
|
10+
LL | match 0usize { //~ ERROR non-exhaustive patterns
11+
| ^^^^^^ patterns `0usize` and `21usize..=18446744073709551615usize` not covered
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0004`.

0 commit comments

Comments
 (0)