Fix bug in matching on floating-point ranges
This commit is contained in:
parent
0fb52fb538
commit
4406391cdc
8 changed files with 35 additions and 56 deletions
|
|
@ -1,8 +0,0 @@
|
|||
warning: unreachable pattern
|
||||
--> $DIR/vec-matching-autoslice.rs:31:9
|
||||
|
|
||||
LL | ([_, _], _) => panic!(),
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unreachable_patterns)] on by default
|
||||
|
||||
|
|
@ -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"),
|
||||
| ^
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
warning: unreachable pattern
|
||||
--> $DIR/issue-7222.rs:20:9
|
||||
|
|
||||
LL | _ => ()
|
||||
| ^
|
||||
|
|
||||
= note: #[warn(unreachable_patterns)] on by default
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue