Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillot
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error. This is part of implementing https://github.com/rust-lang/rfcs/pull/3535. Closes https://github.com/rust-lang/rust/issues/41620 by removing the lint. https://github.com/rust-lang/reference/pull/1456 updates the reference to match.
This commit is contained in:
commit
d13ce192c9
@ -20,12 +20,8 @@ mod rustc_ok {
|
|||||||
pub fn rustc_lints() {
|
pub fn rustc_lints() {
|
||||||
let x = 42.0;
|
let x = 42.0;
|
||||||
|
|
||||||
#[expect(illegal_floating_point_literal_pattern)]
|
#[expect(invalid_nan_comparisons)]
|
||||||
match x {
|
let _b = x == f32::NAN;
|
||||||
5.0 => {}
|
|
||||||
6.0 => {}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,13 +34,9 @@ mod rustc_warn {
|
|||||||
pub fn rustc_lints() {
|
pub fn rustc_lints() {
|
||||||
let x = 42;
|
let x = 42;
|
||||||
|
|
||||||
#[expect(illegal_floating_point_literal_pattern)]
|
#[expect(invalid_nan_comparisons)]
|
||||||
//~^ ERROR: this lint expectation is unfulfilled
|
//~^ ERROR: this lint expectation is unfulfilled
|
||||||
match x {
|
let _b = x == 5;
|
||||||
5 => {}
|
|
||||||
6 => {}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: this lint expectation is unfulfilled
|
error: this lint expectation is unfulfilled
|
||||||
--> $DIR/expect_tool_lint_rfc_2383.rs:35:14
|
--> $DIR/expect_tool_lint_rfc_2383.rs:31:14
|
||||||
|
|
|
|
||||||
LL | #[expect(dead_code)]
|
LL | #[expect(dead_code)]
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
@ -8,31 +8,31 @@ LL | #[expect(dead_code)]
|
|||||||
= help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`
|
= help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`
|
||||||
|
|
||||||
error: this lint expectation is unfulfilled
|
error: this lint expectation is unfulfilled
|
||||||
--> $DIR/expect_tool_lint_rfc_2383.rs:41:18
|
--> $DIR/expect_tool_lint_rfc_2383.rs:37:18
|
||||||
|
|
|
|
||||||
LL | #[expect(illegal_floating_point_literal_pattern)]
|
LL | #[expect(invalid_nan_comparisons)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this lint expectation is unfulfilled
|
error: this lint expectation is unfulfilled
|
||||||
--> $DIR/expect_tool_lint_rfc_2383.rs:116:14
|
--> $DIR/expect_tool_lint_rfc_2383.rs:108:14
|
||||||
|
|
|
|
||||||
LL | #[expect(clippy::almost_swapped)]
|
LL | #[expect(clippy::almost_swapped)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this lint expectation is unfulfilled
|
error: this lint expectation is unfulfilled
|
||||||
--> $DIR/expect_tool_lint_rfc_2383.rs:124:14
|
--> $DIR/expect_tool_lint_rfc_2383.rs:116:14
|
||||||
|
|
|
|
||||||
LL | #[expect(clippy::bytes_nth)]
|
LL | #[expect(clippy::bytes_nth)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this lint expectation is unfulfilled
|
error: this lint expectation is unfulfilled
|
||||||
--> $DIR/expect_tool_lint_rfc_2383.rs:130:14
|
--> $DIR/expect_tool_lint_rfc_2383.rs:122:14
|
||||||
|
|
|
|
||||||
LL | #[expect(clippy::if_same_then_else)]
|
LL | #[expect(clippy::if_same_then_else)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this lint expectation is unfulfilled
|
error: this lint expectation is unfulfilled
|
||||||
--> $DIR/expect_tool_lint_rfc_2383.rs:136:14
|
--> $DIR/expect_tool_lint_rfc_2383.rs:128:14
|
||||||
|
|
|
|
||||||
LL | #[expect(clippy::overly_complex_bool_expr)]
|
LL | #[expect(clippy::overly_complex_bool_expr)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
Loading…
x
Reference in New Issue
Block a user