Closed
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