Skip to content

Commit e59f803

Browse files
bors[bot]Amanieu
andcommitted
Merge #31
31: Add raw_entry + misc cleanups r=Amanieu a=Amanieu This PR adds: - The `raw_entry` API from std. - Support for `#[may_dangle]` when the `nightly` feature is enabled. - `HashMap` and `HashSet` tests from std. - Misc code cleanups. - `try_reserve`. - Fixed variance on `IterMut`. Fixes #23 Fixes #39 Co-authored-by: Amanieu d'Antras <[email protected]>
2 parents 341e550 + f6b2ef8 commit e59f803

File tree

9 files changed

+2446
-358
lines changed

9 files changed

+2446
-358
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extern crate hashbrown;
7373

7474
This crate has the following Cargo features:
7575

76-
- `nightly`: Enables nightly-only features: `no_std` support and ~10% speedup from branch hint intrinsics.
76+
- `nightly`: Enables nightly-only features: `no_std` support, `#[may_dangle]` and ~10% speedup from branch hint intrinsics.
7777

7878
## License
7979

src/lib.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@
1818
allocator_api,
1919
ptr_offset_from,
2020
test,
21-
core_intrinsics
21+
core_intrinsics,
22+
dropck_eyepatch
2223
)
2324
)]
2425
#![warn(missing_docs)]
2526

27+
#[cfg(test)]
28+
#[macro_use]
29+
extern crate std;
30+
#[cfg(test)]
31+
extern crate rand;
32+
2633
#[cfg(feature = "nightly")]
2734
#[cfg_attr(test, macro_use)]
2835
extern crate alloc;
@@ -73,3 +80,13 @@ pub mod hash_set {
7380

7481
pub use map::HashMap;
7582
pub use set::HashSet;
83+
84+
/// Augments `AllocErr` with a CapacityOverflow variant.
85+
#[derive(Clone, PartialEq, Eq, Debug)]
86+
pub enum CollectionAllocErr {
87+
/// Error due to the computed capacity exceeding the collection's maximum
88+
/// (usually `isize::MAX` bytes).
89+
CapacityOverflow,
90+
/// Error due to the allocator (see the `AllocErr` type's docs).
91+
AllocErr,
92+
}

0 commit comments

Comments
 (0)