Report hash value at HashMap corruption location.

This commit is contained in:
Alexis Beingessner 2017-10-19 23:58:02 -04:00 committed by Emilio Cobos Álvarez
parent 07e9794306
commit f7f898b3b3
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 27 additions and 5 deletions

View file

@ -1130,6 +1130,15 @@ impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
}
}
impl<'a, K, V> Iter<'a, K, V> {
pub fn next_with_hash(&mut self) -> Option<(usize, &'a K, &'a V)> {
self.iter.next().map(|raw| unsafe {
let (hash_ptr, pair_ptr) = raw.hash_pair();
(*hash_ptr, &(*pair_ptr).0, &(*pair_ptr).1)
})
}
}
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
type Item = (&'a K, &'a mut V);