1
Fork 0

Auto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum

Update hashbrown to 0.12.0

[Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0120---2022-01-17)
This commit is contained in:
bors 2022-01-22 23:39:21 +00:00
commit 10c4c4afec
3 changed files with 29 additions and 10 deletions

View file

@ -19,7 +19,7 @@ libc = { version = "0.2.108", default-features = false, features = ['rustc-dep-o
compiler_builtins = { version = "0.1.66" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
hashbrown = { version = "0.11", default-features = false, features = ['rustc-dep-of-std'] }
hashbrown = { version = "0.12", default-features = false, features = ['rustc-dep-of-std'] }
std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = ['rustc-dep-of-std'] }
# Dependencies of the `backtrace` crate

View file

@ -817,6 +817,7 @@ fn test_retain() {
}
#[test]
#[cfg_attr(target_os = "android", ignore)] // Android used in CI has a broken dlmalloc
fn test_try_reserve() {
let mut empty_bytes: HashMap<u8, u8> = HashMap::new();
@ -828,11 +829,21 @@ fn test_try_reserve() {
"usize::MAX should trigger an overflow!"
);
assert_matches!(
empty_bytes.try_reserve(MAX_USIZE / 8).map_err(|e| e.kind()),
Err(AllocError { .. }),
"usize::MAX / 8 should trigger an OOM!"
);
if let Err(AllocError { .. }) = empty_bytes.try_reserve(MAX_USIZE / 16).map_err(|e| e.kind()) {
} else {
// This may succeed if there is enough free memory. Attempt to
// allocate a few more hashmaps to ensure the allocation will fail.
let mut empty_bytes2: HashMap<u8, u8> = HashMap::new();
let _ = empty_bytes2.try_reserve(MAX_USIZE / 16);
let mut empty_bytes3: HashMap<u8, u8> = HashMap::new();
let _ = empty_bytes3.try_reserve(MAX_USIZE / 16);
let mut empty_bytes4: HashMap<u8, u8> = HashMap::new();
assert_matches!(
empty_bytes4.try_reserve(MAX_USIZE / 16).map_err(|e| e.kind()),
Err(AllocError { .. }),
"usize::MAX / 16 should trigger an OOM!"
);
}
}
#[test]