-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ambiguous_wide_pointer_comparisons
false positive for Ord
and PartialOrd
#141510
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
Comments
The warning states "use
We should probably not mention |
I actually need the |
Then you can just allow the lint, since it's expected for you, put If we had some version of |
I can see a rational for that. Allowing the lint is also an option. I think it would be quite unfortunate to reduce the scope of the lint simply because we don't have a "nice" std function to avoid it. Comparing pointers with metadata is also never what you want. |
I need to use it for this: facet-rs/facet#675 |
What if the suggested output for the
|
That would be nice 👍 |
…e1-dead Improve `ambiguous_wide_pointer_comparisons` lint compare diagnostics This PR improves the `ambiguous_wide_pointer_comparisons` lint compare diagnostics: `cmp`/`partial_cmp`, but also the operators `<`/`>`/`>=`/`<=`, by: 1. removing the reference to `std::ptr::addr_eq` which only works for equality 2. and adding an `#[expect]` suggestion for keeping the current behavior Fixes rust-lang#141510
Rollup merge of #141536 - Urgau:ambi_wide_ptr-cmp-diag, r=fee1-dead Improve `ambiguous_wide_pointer_comparisons` lint compare diagnostics This PR improves the `ambiguous_wide_pointer_comparisons` lint compare diagnostics: `cmp`/`partial_cmp`, but also the operators `<`/`>`/`>=`/`<=`, by: 1. removing the reference to `std::ptr::addr_eq` which only works for equality 2. and adding an `#[expect]` suggestion for keeping the current behavior Fixes #141510
Uh oh!
There was an error while loading. Please reload this page.
Code
Current output
Desired output
Rationale and extra context
The warning references
std::ptr::addr_eq
, however that can't be used for ordering two pointers.Either
std::ptr::cmp
should be added tostd
(andcore
) which can be referenced instead or the lint should simply not be triggered by<pointer>::cmp
and<pointer>::partial_cmp
.Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: