Fix bug in matching on floating-point ranges

This commit is contained in:
varkor 2018-11-30 21:13:16 +00:00
parent 0fb52fb538
commit 4406391cdc
8 changed files with 35 additions and 56 deletions

View file

@ -1,8 +0,0 @@
warning: unreachable pattern
--> $DIR/vec-matching-autoslice.rs:31:9
|
LL | ([_, _], _) => panic!(),
| ^^^^^^^^^^^
|
= note: #[warn(unreachable_patterns)] on by default

View file

@ -1,20 +0,0 @@
warning: unreachable pattern
--> $DIR/match-range.rs:47:7
|
LL | _ => panic!("should match float range")
| ^
|
= note: #[warn(unreachable_patterns)] on by default
warning: unreachable pattern
--> $DIR/match-range.rs:55:9
|
LL | _ => {},
| ^
warning: unreachable pattern
--> $DIR/match-range.rs:59:9
|
LL | _ => panic!("should match the range start"),
| ^

View file

@ -1,8 +0,0 @@
warning: unreachable pattern
--> $DIR/issue-15881-model-lexer-dotdotdot.rs:41:7
|
LL | _ => panic!("should match float range")
| ^
|
= note: #[warn(unreachable_patterns)] on by default

View file

@ -1,8 +0,0 @@
warning: unreachable pattern
--> $DIR/issue-7222.rs:20:9
|
LL | _ => ()
| ^
|
= note: #[warn(unreachable_patterns)] on by default

View file

@ -62,11 +62,5 @@ error: unreachable pattern
LL | 0.02f64 => {}
| ^^^^^^^
error: unreachable pattern
--> $DIR/match-range-fail-dominate.rs:47:7
|
LL | _ => {}
| ^
error: aborting due to 6 previous errors
error: aborting due to 5 previous errors

View file

@ -0,0 +1,13 @@
#![allow(illegal_floating_point_literal_pattern)]
#![deny(unreachable_patterns)]
fn main() {
match 0.0 {
0.0..=1.0 => {}
_ => {} // ok
}
match 0.0 { //~ ERROR non-exhaustive patterns
0.0..=1.0 => {}
}
}

View file

@ -0,0 +1,9 @@
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/non-exhaustive-float-range-match.rs:10:11
|
LL | match 0.0 { //~ ERROR non-exhaustive patterns
| ^^^ pattern `_` not covered
error: aborting due to previous error
For more information about this error, try `rustc --explain E0004`.