Add tests
This commit is contained in:
parent
9d6d5d4894
commit
11268b48a1
3 changed files with 92 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
||||||
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
|
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
|
||||||
--> $DIR/pointer-sized-int.rs:48:11
|
--> $DIR/pointer-sized-int.rs:58:11
|
||||||
|
|
|
|
||||||
LL | match 7usize {}
|
LL | match 7usize {}
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:12:11
|
--> $DIR/pointer-sized-int.rs:14:11
|
||||||
|
|
|
|
||||||
LL | match 0usize {
|
LL | match 0usize {
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
@ -14,7 +14,7 @@ LL + _ => todo!()
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:17:11
|
--> $DIR/pointer-sized-int.rs:19:11
|
||||||
|
|
|
|
||||||
LL | match 0isize {
|
LL | match 0isize {
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
@ -28,24 +28,10 @@ LL ~ isize::MIN ..= isize::MAX => {},
|
||||||
LL + _ => todo!()
|
LL + _ => todo!()
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
|
||||||
--> $DIR/pointer-sized-int.rs:22:8
|
|
||||||
|
|
|
||||||
LL | m!(0usize, 0..=usize::MAX);
|
|
||||||
| ^^^^^^ pattern `_` not covered
|
|
||||||
|
|
|
||||||
= note: the matched value is of type `usize`
|
|
||||||
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
|
|
||||||
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
|
|
||||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
|
||||||
|
|
|
||||||
LL | match $s { $($t)+ => {}, _ => todo!() }
|
|
||||||
| ++++++++++++++
|
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:24:8
|
--> $DIR/pointer-sized-int.rs:24:8
|
||||||
|
|
|
|
||||||
LL | m!(0usize, 0..5 | 5..=usize::MAX);
|
LL | m!(0usize, 0..);
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
|
||||||
= note: the matched value is of type `usize`
|
= note: the matched value is of type `usize`
|
||||||
|
@ -59,6 +45,34 @@ LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:26:8
|
--> $DIR/pointer-sized-int.rs:26:8
|
||||||
|
|
|
|
||||||
|
LL | m!(0usize, 0..=usize::MAX);
|
||||||
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
||||||
|
= note: the matched value is of type `usize`
|
||||||
|
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
|
||||||
|
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
|
||||||
|
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||||
|
|
|
||||||
|
LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
|
--> $DIR/pointer-sized-int.rs:28:8
|
||||||
|
|
|
||||||
|
LL | m!(0usize, 0..5 | 5..=usize::MAX);
|
||||||
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
||||||
|
= note: the matched value is of type `usize`
|
||||||
|
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
|
||||||
|
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
|
||||||
|
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||||
|
|
|
||||||
|
LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
|
--> $DIR/pointer-sized-int.rs:30:8
|
||||||
|
|
|
||||||
LL | m!(0usize, 0..usize::MAX | usize::MAX);
|
LL | m!(0usize, 0..usize::MAX | usize::MAX);
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
|
||||||
|
@ -71,7 +85,7 @@ LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
| ++++++++++++++
|
| ++++++++++++++
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `(_, _)` not covered
|
error[E0004]: non-exhaustive patterns: `(_, _)` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:28:8
|
--> $DIR/pointer-sized-int.rs:32:8
|
||||||
|
|
|
|
||||||
LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
|
LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
|
||||||
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
||||||
|
@ -85,7 +99,35 @@ LL | match $s { $($t)+ => {}, (_, _) => todo!() }
|
||||||
| +++++++++++++++++++
|
| +++++++++++++++++++
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:31:8
|
--> $DIR/pointer-sized-int.rs:34:8
|
||||||
|
|
|
||||||
|
LL | m!(0usize, 0..=usize::MAX | usize::MAX..);
|
||||||
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
||||||
|
= note: the matched value is of type `usize`
|
||||||
|
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
|
||||||
|
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
|
||||||
|
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||||
|
|
|
||||||
|
LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
|
--> $DIR/pointer-sized-int.rs:37:8
|
||||||
|
|
|
||||||
|
LL | m!(0isize, ..0 | 0..);
|
||||||
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
||||||
|
= note: the matched value is of type `isize`
|
||||||
|
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
|
||||||
|
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
|
||||||
|
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||||
|
|
|
||||||
|
LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
|
--> $DIR/pointer-sized-int.rs:39:8
|
||||||
|
|
|
|
||||||
LL | m!(0isize, isize::MIN..=isize::MAX);
|
LL | m!(0isize, isize::MIN..=isize::MAX);
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
@ -99,7 +141,7 @@ LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
| ++++++++++++++
|
| ++++++++++++++
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:33:8
|
--> $DIR/pointer-sized-int.rs:41:8
|
||||||
|
|
|
|
||||||
LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX);
|
LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX);
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
@ -113,7 +155,7 @@ LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
| ++++++++++++++
|
| ++++++++++++++
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:35:8
|
--> $DIR/pointer-sized-int.rs:43:8
|
||||||
|
|
|
|
||||||
LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX);
|
LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX);
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
@ -127,7 +169,7 @@ LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
| ++++++++++++++
|
| ++++++++++++++
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `(_, _)` not covered
|
error[E0004]: non-exhaustive patterns: `(_, _)` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:37:8
|
--> $DIR/pointer-sized-int.rs:45:8
|
||||||
|
|
|
|
||||||
LL | m!((0isize, true), (isize::MIN..5, true)
|
LL | m!((0isize, true), (isize::MIN..5, true)
|
||||||
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
||||||
|
@ -141,7 +183,21 @@ LL | match $s { $($t)+ => {}, (_, _) => todo!() }
|
||||||
| +++++++++++++++++++
|
| +++++++++++++++++++
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `_` not covered
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
--> $DIR/pointer-sized-int.rs:41:11
|
--> $DIR/pointer-sized-int.rs:48:8
|
||||||
|
|
|
||||||
|
LL | m!(0isize, ..=isize::MIN | isize::MIN..=isize::MAX | isize::MAX..);
|
||||||
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
|
|
||||||
|
= note: the matched value is of type `isize`
|
||||||
|
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
|
||||||
|
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
|
||||||
|
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||||
|
|
|
||||||
|
LL | match $s { $($t)+ => {}, _ => todo!() }
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `_` not covered
|
||||||
|
--> $DIR/pointer-sized-int.rs:51:11
|
||||||
|
|
|
|
||||||
LL | match 0isize {
|
LL | match 0isize {
|
||||||
| ^^^^^^ pattern `_` not covered
|
| ^^^^^^ pattern `_` not covered
|
||||||
|
@ -156,7 +212,7 @@ LL + _ => todo!()
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
|
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
|
||||||
--> $DIR/pointer-sized-int.rs:48:11
|
--> $DIR/pointer-sized-int.rs:58:11
|
||||||
|
|
|
|
||||||
LL | match 7usize {}
|
LL | match 7usize {}
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
@ -169,6 +225,6 @@ LL + _ => todo!(),
|
||||||
LL + }
|
LL + }
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 12 previous errors
|
error: aborting due to 16 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0004`.
|
For more information about this error, try `rustc --explain E0004`.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// revisions: allow deny
|
// revisions: allow deny
|
||||||
#![feature(exclusive_range_pattern)]
|
#![feature(exclusive_range_pattern)]
|
||||||
#![cfg_attr(allow, feature(precise_pointer_size_matching))]
|
#![cfg_attr(allow, feature(precise_pointer_size_matching))]
|
||||||
|
#![allow(overlapping_range_endpoints)]
|
||||||
|
|
||||||
macro_rules! m {
|
macro_rules! m {
|
||||||
($s:expr, $($t:tt)+) => {
|
($s:expr, $($t:tt)+) => {
|
||||||
|
@ -8,6 +9,7 @@ macro_rules! m {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
fn main() {
|
fn main() {
|
||||||
match 0usize {
|
match 0usize {
|
||||||
//[deny]~^ ERROR non-exhaustive patterns
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
|
@ -19,6 +21,8 @@ fn main() {
|
||||||
isize::MIN ..= isize::MAX => {}
|
isize::MIN ..= isize::MAX => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m!(0usize, 0..);
|
||||||
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
m!(0usize, 0..=usize::MAX);
|
m!(0usize, 0..=usize::MAX);
|
||||||
//[deny]~^ ERROR non-exhaustive patterns
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
m!(0usize, 0..5 | 5..=usize::MAX);
|
m!(0usize, 0..5 | 5..=usize::MAX);
|
||||||
|
@ -27,7 +31,11 @@ fn main() {
|
||||||
//[deny]~^ ERROR non-exhaustive patterns
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
|
m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
|
||||||
//[deny]~^ ERROR non-exhaustive patterns
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
|
m!(0usize, 0..=usize::MAX | usize::MAX..);
|
||||||
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
|
|
||||||
|
m!(0isize, ..0 | 0..);
|
||||||
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
m!(0isize, isize::MIN..=isize::MAX);
|
m!(0isize, isize::MIN..=isize::MAX);
|
||||||
//[deny]~^ ERROR non-exhaustive patterns
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
m!(0isize, isize::MIN..5 | 5..=isize::MAX);
|
m!(0isize, isize::MIN..5 | 5..=isize::MAX);
|
||||||
|
@ -37,6 +45,8 @@ fn main() {
|
||||||
m!((0isize, true), (isize::MIN..5, true)
|
m!((0isize, true), (isize::MIN..5, true)
|
||||||
| (5..=isize::MAX, true) | (isize::MIN..=isize::MAX, false));
|
| (5..=isize::MAX, true) | (isize::MIN..=isize::MAX, false));
|
||||||
//[deny]~^^ ERROR non-exhaustive patterns
|
//[deny]~^^ ERROR non-exhaustive patterns
|
||||||
|
m!(0isize, ..=isize::MIN | isize::MIN..=isize::MAX | isize::MAX..);
|
||||||
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
|
|
||||||
match 0isize {
|
match 0isize {
|
||||||
//[deny]~^ ERROR non-exhaustive patterns
|
//[deny]~^ ERROR non-exhaustive patterns
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue