-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Per the 2023-11-08 lang triage meeting, lang would like to see a lint like the one in the second bullet from #106447 (comment) :
Deprecate comparisons (Eq/Ord) on dyn trait pointers by adding a lint which encourages people to case the pointer to
*mut u8
first. This makes the intent of such comparisons much clearer.
The lint should not warn on comparison of thin pointers.
When non-thin pointers are compared (whether with ==
or !=
or PartialEq
methods directly), the lint should warn, suggesting that you do one of the following instead:
- call https://doc.rust-lang.org/nightly/std/ptr/fn.eq.html if you really wanted to compare both the address and the metadata
- call https://doc.rust-lang.org/nightly/std/ptr/fn.addr_eq.html (or just
.cast::<()>()
) if you only want to compare the addresses
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.