-
Notifications
You must be signed in to change notification settings - Fork 159
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
Improve get_index_mut documentation wrt mutable keys #174
Comments
There should be a warning in docs. It's intended the mutable keys functionality is mostly hidden away in the MutableKeys trait. Users can cause similar bugs with internal mutability in any regular hash map, or other ways of implementing buggy equality/hash functionality. |
But the Perhaps there should also be a |
That sounds good, but on its own it is no reason to release a 2.0 version, it can be on the list in #135 (Edit - oh, it's already on the list) i.e. not likely to be addressed anytime soon. Let's make this issue about just improving docs. |
Yeah, |
This was fixed in #219 to return |
The function
get_index_mut
gives a mutable reference to the of an entry, but does not update the corresponding hash. This means you can write buggy code like this:This does not seem like it is the intended behavior, since e.g.
first_mut
only gives a non-mutable reference to the key.If this is the intended behavior, then there should probably be a warning in the documentation that you should not changing the key in ways which alter the
Hash
orEq
behavior.The text was updated successfully, but these errors were encountered: