diff options
| author | bors <bors@rust-lang.org> | 2022-01-22 23:39:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-22 23:39:21 +0000 |
| commit | 10c4c4afec6dfc483af6efb7019941bab9a51a29 (patch) | |
| tree | 93f775a0c8cae193ffbfac2f0715944b5dac7c4f /library | |
| parent | bfe15646761a75f0259e204cab071565eed2b1e5 (diff) | |
| parent | 537439c17796afe735e26324cbb733dc7fd4bb9f (diff) | |
| download | rust-10c4c4afec6dfc483af6efb7019941bab9a51a29.tar.gz rust-10c4c4afec6dfc483af6efb7019941bab9a51a29.zip | |
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)
Diffstat (limited to 'library')
| -rw-r--r-- | library/std/Cargo.toml | 2 | ||||
| -rw-r--r-- | library/std/src/collections/hash/map/tests.rs | 21 |
2 files changed, 17 insertions, 6 deletions
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 232ccdf39d4..165169aedb3 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -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 diff --git a/library/std/src/collections/hash/map/tests.rs b/library/std/src/collections/hash/map/tests.rs index eac884bfe0f..30da22b8084 100644 --- a/library/std/src/collections/hash/map/tests.rs +++ b/library/std/src/collections/hash/map/tests.rs @@ -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] |
