-
Notifications
You must be signed in to change notification settings - Fork 13k
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
cannot implement Hash except by IterBytes ? #9075
Comments
Ah, the comment above the Still, this limitation in how one implements |
The reason for this limitation is apparent in the implementation, as pointed out to me on IRC: (from hash.rs):
I remain curious as to whether we intend to uphold this limitation permanently, or figure out another approach for resolving this. (But just so I am entirely upfront: I have no objections if we resolve this by saying: "If you want to implement your own hash function, then you have to also implement your own hash table with which to couple it", which is a work-around one can use today if one so desires.) |
see also commentary on #8038 |
This is quite unfortunate. I think it will be solved by the coherence relaxations (coherence currently ignores type parameters, and is thus overzealous), though Hash/IterBytes probably need to be restructured. |
With the new |
Add `dev deprecate` to the development basics changelog: none
A strange problem: Let's say I want to implement the
Hash
trait myself, making use of the hash functions of my substructure, instead of by defining/derivingIterBytes
.rustc rejects my attempts to do so, saying that it failed to find an implementation of
IterBytes
for the structure in question.Just to double-check my work, I cut-and-pasted a renamed version of the
Hash
trait into my code, and checked that I could indeed implement that (which I can):Test case:
Transcript:
The text was updated successfully, but these errors were encountered: