Skip to content

Commit

Permalink
Merge #31
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bors[bot] and Amanieu committed Jan 14, 2019
2 parents 341e550 + b938576 commit 5998edc
Show file tree
Hide file tree
Showing 11 changed files with 2,461 additions and 395 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ branches:
- trying.tmp
- staging.tmp

before_script:
- if [ "$TRAVIS_RUST_VERSION" == "stable" ]; then rustup component add rustfmt; fi

script:
- if [ "$TRAVIS_RUST_VERSION" == "stable" ]; then cargo fmt -- --check; fi

- cargo build --verbose --features "$FEATURES"
- cargo test --verbose --features "$FEATURES"
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo bench --verbose --features "$FEATURES"; fi
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extern crate hashbrown;

This crate has the following Cargo features:

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

## License

Expand Down
10 changes: 0 additions & 10 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(test)]

extern crate hashbrown;
Expand Down
19 changes: 18 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
allocator_api,
ptr_offset_from,
test,
core_intrinsics
core_intrinsics,
dropck_eyepatch
)
)]
#![warn(missing_docs)]

#[cfg(test)]
#[macro_use]
extern crate std;
#[cfg(test)]
extern crate rand;

#[cfg(feature = "nightly")]
#[cfg_attr(test, macro_use)]
extern crate alloc;
Expand Down Expand Up @@ -73,3 +80,13 @@ pub mod hash_set {

pub use map::HashMap;
pub use set::HashSet;

/// Augments `AllocErr` with a CapacityOverflow variant.
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum CollectionAllocErr {
/// Error due to the computed capacity exceeding the collection's maximum
/// (usually `isize::MAX` bytes).
CapacityOverflow,
/// Error due to the allocator (see the `AllocErr` type's docs).
AllocErr,
}
Loading

0 comments on commit 5998edc

Please sign in to comment.