mirror of
https://github.com/servo/servo.git
synced 2025-07-04 22:13:40 +01:00
Revert "Report hash value at HashMap corruption location."
This reverts commit f7f898b3b3
.
This commit is contained in:
parent
bf69d1b460
commit
d48aa12b8d
3 changed files with 5 additions and 27 deletions
|
@ -62,21 +62,17 @@ impl<K: Hash + Eq, V, S: BuildHasher> DiagnosticHashMap<K, V, S>
|
|||
let mut position = 0;
|
||||
let mut count = 0;
|
||||
let mut bad_canary = None;
|
||||
|
||||
let mut iter = self.map.iter();
|
||||
while let Some((h, _, v)) = iter.next_with_hash() {
|
||||
for (_,v) in self.map.iter() {
|
||||
let canary_ref = &v.0;
|
||||
position += 1;
|
||||
|
||||
if *canary_ref == CANARY {
|
||||
continue;
|
||||
}
|
||||
|
||||
count += 1;
|
||||
bad_canary = Some((h, *canary_ref, canary_ref, position));
|
||||
bad_canary = Some((*canary_ref, canary_ref, position));
|
||||
}
|
||||
if let Some(c) = bad_canary {
|
||||
self.report_corruption(c.0, c.1, c.2, c.3, count);
|
||||
self.report_corruption(c.0, c.1, c.2, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +158,6 @@ impl<K: Hash + Eq, V, S: BuildHasher> DiagnosticHashMap<K, V, S>
|
|||
#[inline(never)]
|
||||
fn report_corruption(
|
||||
&self,
|
||||
hash: usize,
|
||||
canary: usize,
|
||||
canary_addr: *const usize,
|
||||
position: usize,
|
||||
|
@ -177,14 +172,12 @@ impl<K: Hash + Eq, V, S: BuildHasher> DiagnosticHashMap<K, V, S>
|
|||
value.as_ptr(),
|
||||
);
|
||||
}
|
||||
|
||||
panic!(
|
||||
concat!("HashMap Corruption (sz={}, cap={}, pairsz={}, hash={:#x}, cnry={:#x}, ",
|
||||
"count={}, last_pos={}, base_addr={:?}, cnry_addr={:?}, jrnl_len={})"),
|
||||
concat!("HashMap Corruption (sz={}, cap={}, pairsz={}, cnry={:#x}, count={}, ",
|
||||
"last_pos={}, base_addr={:?}, cnry_addr={:?}, jrnl_len={})"),
|
||||
self.map.len(),
|
||||
self.map.raw_capacity(),
|
||||
::std::mem::size_of::<(K, (usize, V))>(),
|
||||
hash,
|
||||
canary,
|
||||
count,
|
||||
position,
|
||||
|
|
|
@ -1339,12 +1339,6 @@ impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, K: 'a, V: 'a> Iter<'a, K, V> {
|
||||
pub fn next_with_hash(&mut self) -> Option<(usize, &'a K, &'a V)> {
|
||||
self.inner.next_with_hash()
|
||||
}
|
||||
}
|
||||
|
||||
/// A mutable iterator over the entries of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter_mut`] method on [`HashMap`]. See its
|
||||
|
|
|
@ -1130,15 +1130,6 @@ 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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue