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

@ -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`.