Separate out precise_pointer_size_matching tests from exhaustive_integer_patterns tests

This commit is contained in:
varkor 2018-11-30 21:13:07 +00:00
parent 4fc5758a67
commit 0fb52fb538
4 changed files with 50 additions and 17 deletions

View file

@ -13,7 +13,7 @@
#![deny(unreachable_patterns)]
use std::{char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128};
use std::{char, u8, u16, u32, u64, u128, i8, i16, i32, i64, i128};
fn main() {
let x: u8 = 0;
@ -69,10 +69,6 @@ fn main() {
'\u{E000}' ..= '\u{10_FFFF}' => {}
}
match 0usize {
0 ..= usize::MAX => {} // ok
}
match 0u16 {
0 ..= u16::MAX => {} // ok
}
@ -89,10 +85,6 @@ fn main() {
0 ..= u128::MAX => {} // ok
}
match 0isize {
isize::MIN ..= isize::MAX => {} // ok
}
match 0i8 {
-128 ..= 127 => {} // ok
}

View file

@ -35,49 +35,49 @@ LL | match x { //~ ERROR non-exhaustive patterns
| ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
error[E0004]: non-exhaustive patterns: `-128i8` not covered
--> $DIR/exhaustive_integer_patterns.rs:100:11
--> $DIR/exhaustive_integer_patterns.rs:92:11
|
LL | match 0i8 { //~ ERROR non-exhaustive patterns
| ^^^ pattern `-128i8` not covered
error[E0004]: non-exhaustive patterns: `0i16` not covered
--> $DIR/exhaustive_integer_patterns.rs:108:11
--> $DIR/exhaustive_integer_patterns.rs:100:11
|
LL | match 0i16 { //~ ERROR non-exhaustive patterns
| ^^^^ pattern `0i16` not covered
error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
--> $DIR/exhaustive_integer_patterns.rs:126:11
--> $DIR/exhaustive_integer_patterns.rs:118:11
|
LL | match 0u8 { //~ ERROR non-exhaustive patterns
| ^^^ pattern `128u8..=255u8` not covered
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
--> $DIR/exhaustive_integer_patterns.rs:138:11
--> $DIR/exhaustive_integer_patterns.rs:130:11
|
LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered
--> $DIR/exhaustive_integer_patterns.rs:143:11
--> $DIR/exhaustive_integer_patterns.rs:135:11
|
LL | match (0u8, true) { //~ ERROR non-exhaustive patterns
| ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered
error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered
--> $DIR/exhaustive_integer_patterns.rs:163:11
--> $DIR/exhaustive_integer_patterns.rs:155:11
|
LL | match 0u128 { //~ ERROR non-exhaustive patterns
| ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered
error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered
--> $DIR/exhaustive_integer_patterns.rs:167:11
--> $DIR/exhaustive_integer_patterns.rs:159:11
|
LL | match 0u128 { //~ ERROR non-exhaustive patterns
| ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered
error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered
--> $DIR/exhaustive_integer_patterns.rs:171:11
--> $DIR/exhaustive_integer_patterns.rs:163:11
|
LL | match 0u128 { //~ ERROR non-exhaustive patterns
| ^^^^^ pattern `0u128..=3u128` not covered

View file

@ -0,0 +1,26 @@
#![feature(precise_pointer_size_matching)]
#![feature(exclusive_range_pattern)]
#![deny(unreachable_patterns)]
use std::{usize, isize};
fn main() {
match 0isize {
isize::MIN ..= isize::MAX => {} // ok
}
match 0usize {
0 ..= usize::MAX => {} // ok
}
match 0isize { //~ ERROR non-exhaustive patterns
1 ..= 8 => {}
-5 ..= 20 => {}
}
match 0usize { //~ ERROR non-exhaustive patterns
1 ..= 8 => {}
5 ..= 20 => {}
}
}

View file

@ -0,0 +1,15 @@
error[E0004]: non-exhaustive patterns: `-9223372036854775808isize..=-6isize` and `21isize..=9223372036854775807isize` not covered
--> $DIR/precise_pointer_size_matching.rs:17:11
|
LL | match 0isize { //~ ERROR non-exhaustive patterns
| ^^^^^^ patterns `-9223372036854775808isize..=-6isize` and `21isize..=9223372036854775807isize` not covered
error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=18446744073709551615usize` not covered
--> $DIR/precise_pointer_size_matching.rs:22:11
|
LL | match 0usize { //~ ERROR non-exhaustive patterns
| ^^^^^^ patterns `0usize` and `21usize..=18446744073709551615usize` not covered
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0004`.