-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid invalid NaN lint machine-applicable suggestion in const context #114486
Avoid invalid NaN lint machine-applicable suggestion in const context #114486
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
I wonder if we should just see what's blocking stabilizing |
Well in that case, shouldn't we just be suggesting nothing? I don't think turning this into a help that still tells folks to use the same fn is the right solution. |
cc264a1
to
b71f2be
Compare
It's a bit unsatisfying to not have any suggestion for const context, but I agree, better suggest nothing than suggest functions that have no plan to stabilization in the short or medium term. Updated the PR to completely remove the suggestion. |
e: &hir::Expr<'_>, | ||
l: &hir::Expr<'_>, | ||
r: &hir::Expr<'_>, | ||
f: impl FnOnce(Span, Span) -> InvalidNanComparisonsSuggestion, | ||
) -> InvalidNanComparisons { | ||
let suggestion = | ||
let suggestion = (!cx.tcx.hir().is_inside_const_context(e.hir_id)).then(|| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is a somewhat confusing way of avoiding an if
statement 😅
@bors r+ rollup |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#114486 (Avoid invalid NaN lint machine-applicable suggestion in const context) - rust-lang#114503 (Remove invalid lint when there is a generic argument in prefix path) - rust-lang#114509 (Migrate GUI colors test to original CSS color format) - rust-lang#114524 (Also ICE when goals go from Ok to Err in new solver) r? `@ghost` `@rustbot` modify labels: rollup
…sify, r=RalfJung Stabilize `const_float_classify` Tracking issue: rust-lang#72505 Also reverts rust-lang#114486 Closes rust-lang#72505 Stabilized const API: ```rust impl f32 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } impl f64 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } ``` cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
…alfJung Stabilize `const_float_classify` Tracking issue: rust-lang/rust#72505 Also reverts rust-lang/rust#114486 Closes rust-lang/rust#72505 Stabilized const API: ```rust impl f32 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } impl f64 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } ``` cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
…alfJung Stabilize `const_float_classify` Tracking issue: rust-lang/rust#72505 Also reverts rust-lang/rust#114486 Closes rust-lang/rust#72505 Stabilized const API: ```rust impl f32 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } impl f64 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } ``` cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
This PR removes the machine-applicable suggestion in const context for the
invalid_nan_comparision
lintand replace it with a simple help.Fixes #114471