-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ambiguous_wide_pointer_comparisons
lint does not trigger for NonNull
comparisons
#121264
Comments
Generically detecting inner ADT comparisons cases is not going do be easy since non automatically-derived However detecting the other cases with @rustbot claim |
I figured a special case could be made for |
This could indeed be a temporary solution. The more general solution would probably involved a custom rustc attribute that would "bubble-up" the warning, since internally the NonNull methods do get the warnings! |
…Nadrieril Add detection of [Partial]Ord methods in the `ambiguous_wide_pointer_comparisons` lint Partially addresses rust-lang#121264 by adding diagnostics items for PartialOrd and Ord methods, detecting such diagnostics items as "binary operation" and suggesting the correct replacement. I also took the opportunity to change the suggestion to use new methods `.cast()` on `*mut T` an d `*const T`.
Add detection of [Partial]Ord methods in the `ambiguous_wide_pointer_comparisons` lint Partially addresses rust-lang/rust#121264 by adding diagnostics items for PartialOrd and Ord methods, detecting such diagnostics items as "binary operation" and suggesting the correct replacement. I also took the opportunity to change the suggestion to use new methods `.cast()` on `*mut T` an d `*const T`.
…eril Add support for `NonNull`s in the `ambiguous_wide_ptr_comparisions` lint This PR add support for `NonNull` pointers in the `ambiguous_wide_ptr_comparisions` lint. Fixes rust-lang#121264 r? `@Nadrieril` (since you just reviewed rust-lang#121268, feel free to reassign)
Add support for `NonNull`s in the `ambiguous_wide_ptr_comparisions` lint This PR add support for `NonNull` pointers in the `ambiguous_wide_ptr_comparisions` lint. Fixes rust-lang/rust#121264 r? `@Nadrieril` (since you just reviewed #121268, feel free to reassign)
Code
Current output
Desired output
Rationale and extra context
#117758 added the
ambiguous_wide_pointer_comparisons
lint, but the implementation doesn't consider pointer types beyond*const T
and*mut T
.Other cases
I've also found that explicit
PartialOrd::partial_cmp
andOrd::cmp
calls are not warned with ordinary pointers.Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: