Avoid invalid NaN lint machine-applicable suggestion in const context#114486
Merged
bors merged 2 commits intorust-lang:masterfrom Aug 6, 2023
Merged
Avoid invalid NaN lint machine-applicable suggestion in const context#114486bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
Collaborator
|
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
Contributor
|
I wonder if we should just see what's blocking stabilizing |
Member
Author
Contributor
|
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
Member
Author
|
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. |
compiler-errors
approved these changes
Aug 6, 2023
| f: impl FnOnce(Span, Span) -> InvalidNanComparisonsSuggestion, | ||
| ) -> InvalidNanComparisons { | ||
| let suggestion = | ||
| let suggestion = (!cx.tcx.hir().is_inside_const_context(e.hir_id)).then(|| { |
Contributor
There was a problem hiding this comment.
nit: this is a somewhat confusing way of avoiding an if statement 😅
Contributor
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 6, 2023
…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
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 4, 2024
…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`
lnicola
pushed a commit
to lnicola/rust-analyzer
that referenced
this pull request
Oct 8, 2024
…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`
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this pull request
Oct 14, 2024
…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`
Kobzol
pushed a commit
to Kobzol/portable-simd
that referenced
this pull request
Feb 3, 2026
…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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the machine-applicable suggestion in const context for the
invalid_nan_comparisionlintand replace it with a simple help.Fixes #114471