Skip to content

Commit 06f3b57

Browse files
authored
Rollup merge of rust-lang#56561 - Zoxc:too-raw, r=Gankro
Fix bug in from_key_hashed_nocheck
2 parents aa5ba83 + 7df4b81 commit 06f3b57

File tree

1 file changed

+4
-0
lines changed
  • src/libstd/collections/hash

1 file changed

+4
-0
lines changed

src/libstd/collections/hash/map.rs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use self::Entry::*;
1212
use self::VacantEntryState::*;
1313

14+
use intrinsics::unlikely;
1415
use collections::CollectionAllocErr;
1516
use cell::Cell;
1617
use borrow::Borrow;
@@ -1992,6 +1993,9 @@ impl<'a, K, V, S> RawEntryBuilder<'a, K, V, S>
19921993
fn search<F>(self, hash: u64, is_match: F, compare_hashes: bool) -> Option<(&'a K, &'a V)>
19931994
where F: FnMut(&K) -> bool
19941995
{
1996+
if unsafe { unlikely(self.map.table.size() == 0) } {
1997+
return None;
1998+
}
19951999
match search_hashed_nonempty(&self.map.table,
19962000
SafeHash::new(hash),
19972001
is_match,

0 commit comments

Comments
 (0)