Skip to content
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

enforce HashMap to use TotalEq #10619

Closed
wants to merge 1 commit into from
Closed

enforce HashMap to use TotalEq #10619

wants to merge 1 commit into from

Conversation

dredozubov
Copy link

discussed in #5283 and #4510
Seemed pretty straightforard, can anyone give it a look?

@thestinger
Copy link
Contributor

This doesn't change the bound on the key type to TotalEq from Eq, so it's not changing the requirements on the keys.

@dredozubov
Copy link
Author

@thestinger Hm, seems like i totally misunderstood the problem. So, we're basically looking for <K:Hash + Eq,V:Eq> -> <K:Hash + TotalEq,V:Eq> changes, so all keys must be TotalEq'ed?
Also it seems logical to me to have TotalEq trait on HashMap.

@thestinger
Copy link
Contributor

Yeah, but I'm not sure if it's the right way forward. It would be easier to just remove the Eq implementation from floats and rely solely on the built-in operators for them.

#10320

@alexcrichton
Copy link
Member

Closing due to a lack of activity. This is a fairly fundamental change which may also require rethinking of whether TotalEq is necessary to have in tandem with Eq. Additionally, I believe the intent of the original bug was to replace the Eq bound with TotalEq rather than implementing TotalEq on hash maps.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 18, 2022
fix(generate_method): correct method indentation inside generated impl and change gen loc

should fix rust-lang#10619
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 18, 2024
Show interior mutability chain in `mutable_key_type`

Fixes rust-lang#10619

Just ran into this myself and I definitely agree it's not very nice to have to manually go through all the types involved to figure out why this happens and to evaluate if this is really a problem (knowing if the field of a struct is something that a hash impl relies on), so this changes the lint to emit notes for each step involved.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants