-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PartialEq between reference and non-reference type? #1332
Comments
Trait coherence prevents it :( See rust-lang/rust#23521 for one (unsuccessful) attempt to fix it with help of OIBITs. |
@petrochenkov It seems like specialization is mostly implemented (tracking issue, PR). I just came across this issue again and wanted to ask if there's anything new? :) |
I'm not sure specialisation helps in this situation. The problem as I see it is that if you something where: EDIT: Alternatively, if you could specify that a trait only applies to non-reference types, this should also solve the problem, along with the existing rules for referencing both types. |
Would something like rust-lang/rust#42721 help there? (Referring to |
I'm not sure, if that's intended, but it's "impossible" to compare a reference type with a non-reference type via
PartialEq
. Short example code:This should work in my opinion. There already are these
impl
s in std (I removed some noise -- original):The third line in my example works because of this.
Why not something like this?
Or do I misunderstand something?
The text was updated successfully, but these errors were encountered: