-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Change HashMap to be hasher-generic #12544
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
Conversation
looks fine besides the doc nits. |
self.pop_internal(hash, k) | ||
} | ||
} | ||
|
||
impl<K: Hash + Eq, V> HashMap<K, V> { | ||
impl<K: Hash<SipState> + Eq, V> HashMap<K, V, SipHasher> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, this signature doesn't need to change, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, you're right it shouldn't need to be changed.
I'm a little uneasy enabling default type parameters in lots more crates, was this done to fix compile errors or to make hashing these types more robust? I would rather rely on |
I'm a little worried about documentation/readability; these signatures have reached the point that they're completely opaque. Just a concern, probably shouldn't block this. |
@alexcrichton: A couple things:
|
@cmr: updated the pr with your doc fixes. @alexcrichton: I factored out making a bunch of types hasher-generic into a future PR. I've left in a hasher-generic |
This PR allows `HashMap`s to work with custom hashers. Also with this patch are: * a couple generic implementations of `Hash` for a variety of types. * added `Default`, `Clone` impls to the hashers. * added a `HashMap::with_hasher()` constructor.
Show proc-macro loading errors in unresolved-proc-macro diagnostics This should help out people to potentially figure out the problem without having to check the logs
…ffix Fixes rust-lang#12544. - don't report an item name if it consists only of a prefix from `allowed-prefixes` list and a module name (e.g. `AsFoo` in module `foo`). - configured by `allowed-prefixes` config entry - prefixes allowed by default: [`to`, `from`, `into`, `as`, `try_into`, `try_from`] - update docs
…ns-in-module-name-repetitions, r=Jarcho [`module_name_repetition`] Recognize common prepositions Fixes rust-lang#12544 changelog: [`module_name_repetition`]: don't report an item name if it consists only of a prefix from `allowed-prefixes` list and a module name (e.g. `AsFoo` in module `foo`). Prefixes allowed by default: [`to`, `from`, `into`, `as`, `try_into`, `try_from`]
This PR allows
HashMap
s to work with custom hashers. Also with this patch are:Hash
for a variety of types.Default
,Clone
impls to the hashers.HashMap::with_hasher()
constructor.