Skip to content

Commit

Permalink
Improve integer range tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Nov 21, 2020
1 parent 82bf5b6 commit 3213efc
Show file tree
Hide file tree
Showing 28 changed files with 907 additions and 665 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#![feature(exclusive_range_pattern)]

use std::usize::MAX;
use std::{isize, usize};

fn main() {
match 0usize { //~ERROR non-exhaustive patterns: `_` not covered
0..=MAX => {}
match 0usize {
//~^ ERROR non-exhaustive patterns: `_` not covered
//~| NOTE pattern `_` not covered
//~| NOTE the matched value is of type `usize`
//~| NOTE `usize` does not have a fixed maximum value
0..=usize::MAX => {}
}

match 0isize { //~ERROR non-exhaustive patterns: `_` not covered
1..=20 => {}
-5..3 => {}
match 0isize {
//~^ ERROR non-exhaustive patterns: `_` not covered
//~| NOTE pattern `_` not covered
//~| NOTE the matched value is of type `isize`
//~| NOTE `isize` does not have a fixed maximum value
isize::MIN..=isize::MAX => {}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:6:11
--> $DIR/feature-gate-precise_pointer_size_matching.rs:4:11
|
LL | match 0usize {
| ^^^^^^ pattern `_` not covered
Expand All @@ -10,7 +10,7 @@ LL | match 0usize {
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching

error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
--> $DIR/feature-gate-precise_pointer_size_matching.rs:12:11
|
LL | match 0isize {
| ^^^^^^ pattern `_` not covered
Expand Down
172 changes: 0 additions & 172 deletions src/test/ui/pattern/usefulness/exhaustive_integer_patterns.rs

This file was deleted.

146 changes: 0 additions & 146 deletions src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ fn main() {
match 0.0 { //~ ERROR non-exhaustive patterns
0.0..=1.0 => {}
}

match 1.0f64 {
0.01f64 ..= 6.5f64 => {}
0.02f64 => {} //~ ERROR unreachable pattern
_ => {}
};
}
Loading

0 comments on commit 3213efc

Please sign in to comment.