Rollup merge of #89443 - cuviper:btree-hash-len, r=dtolnay
Include the length in BTree hashes This change makes it consistent with `Hash` for all other collections.
This commit is contained in:
commit
e1478d650d
2 changed files with 13 additions and 2 deletions
|
@ -1968,6 +1968,7 @@ impl<'a, K: Ord + Copy, V: Copy> Extend<(&'a K, &'a V)> for BTreeMap<K, V> {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<K: Hash, V: Hash> Hash for BTreeMap<K, V> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.len().hash(state);
|
||||
for elt in self {
|
||||
elt.hash(state);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue