diff --git a/.travis.yml b/.travis.yml index 752afba38c..169178f061 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,8 +33,8 @@ matrix: - name: "x86_64-unknown-linux-gnu (stable)" rust: stable env: TARGET=x86_64-unknown-linux-gnu - - name: "x86_64-unknown-linux-gnu (Rust 1.31.0)" - rust: 1.31.0 + - name: "x86_64-unknown-linux-gnu (Rust 1.32.0)" + rust: 1.32.0 env: TARGET=x86_64-unknown-linux-gnu - name: "i686-unknown-linux-gnu" env: TARGET=i686-unknown-linux-gnu CROSS=1 @@ -62,6 +62,14 @@ matrix: - name: "aarch64-unknown-linux-gnu" env: TARGET=aarch64-unknown-linux-gnu CROSS=1 + # Ensure that we successfully build without libstd + - name: "thumbv6m-none-eabi" + env: TARGET=thumbv6m-none-eabi NO_STD=1 + script: + # cross doesn't seem to work with thumb targets... + - rustup target install $TARGET + - sh ci/run.sh + install: travis_retry rustup target add "${TARGET}" script: sh ci/run.sh diff --git a/Cargo.toml b/Cargo.toml index 2200c119aa..1ac1a22e55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ build = "build.rs" [dependencies] # For the default hasher -ahash = { version = "0.2", optional = true } +ahash = { version = "0.2.11", optional = true } # For external trait impls rayon = { version = "1.0", optional = true } diff --git a/ci/run.sh b/ci/run.sh index bb52d43272..613373613a 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -4,7 +4,14 @@ set -ex : "${TARGET?The TARGET environment variable must be set.}" -FEATURES="rayon,serde,rustc-internal-api" +if [ "${NO_STD}" = "1" ]; then + # Unfortunately serde currently doesn't work without std due to a cargo bug. + FEATURES="rustc-internal-api" + OP="build" +else + FEATURES="rustc-internal-api,serde,rayon" + OP="test" +fi if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then FEATURES="${FEATURES},nightly" export RUSTFLAGS="$RUSTFLAGS -D warnings" @@ -19,18 +26,17 @@ if [ "${CROSS}" = "1" ]; then CARGO=cross fi -export RUSTFLAGS="$RUSTFLAGS --cfg hashbrown_deny_warnings" - # Make sure we can compile without the default hasher -"${CARGO}" -vv check --target="${TARGET}" --no-default-features +"${CARGO}" -vv build --target="${TARGET}" --no-default-features +"${CARGO}" -vv build --target="${TARGET}" --release --no-default-features -"${CARGO}" -vv test --target="${TARGET}" -"${CARGO}" -vv test --target="${TARGET}" --features "${FEATURES}" +"${CARGO}" -vv ${OP} --target="${TARGET}" +"${CARGO}" -vv ${OP} --target="${TARGET}" --features "${FEATURES}" -"${CARGO}" -vv test --target="${TARGET}" --release -"${CARGO}" -vv test --target="${TARGET}" --release --features "${FEATURES}" +"${CARGO}" -vv ${OP} --target="${TARGET}" --release +"${CARGO}" -vv ${OP} --target="${TARGET}" --release --features "${FEATURES}" -if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then +if [ "${TRAVIS_RUST_VERSION}" = "nightly" ] && [ "${NO_STD}" != 1 ]; then # Run benchmark on native targets, build them on non-native ones: NO_RUN="" if [ "${CROSS}" = "1" ]; then diff --git a/ci/tools.sh b/ci/tools.sh index fe2ba52f08..c6b014ca3b 100644 --- a/ci/tools.sh +++ b/ci/tools.sh @@ -13,7 +13,7 @@ retry() { "$@" result=$? [ $result -eq 0 ] && break - count=$(count + 1) + count=$((count + 1)) sleep 1 done diff --git a/src/map.rs b/src/map.rs index fe6823dc94..822a51c3a4 100644 --- a/src/map.rs +++ b/src/map.rs @@ -18,7 +18,7 @@ pub enum DefaultHashBuilder {} /// A hash map implemented with quadratic probing and SIMD lookup. /// -/// The default hashing algorithm is currently [AHash], though this is +/// The default hashing algorithm is currently [`AHash`], though this is /// subject to change at any point in the future. This hash function is very /// fast for all types of keys, but this algorithm will typically *not* protect /// against attacks such as HashDoS. @@ -145,7 +145,7 @@ pub enum DefaultHashBuilder {} /// [`with_hasher`]: #method.with_hasher /// [`with_capacity_and_hasher`]: #method.with_capacity_and_hasher /// [`fnv`]: https://crates.io/crates/fnv -/// [AHash]: https://crates.io/crates/ahash +/// [`AHash`]: https://crates.io/crates/ahash /// /// ``` /// use hashbrown::HashMap; diff --git a/src/raw/mod.rs b/src/raw/mod.rs index 96d991843b..18b55c2f49 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -73,18 +73,20 @@ impl Fallibility { /// Error to return on capacity overflow. #[inline] fn capacity_overflow(self) -> CollectionAllocErr { + use Fallibility::*; match self { - Fallibility::Fallible => CollectionAllocErr::CapacityOverflow, - Fallibility::Infallible => panic!("Hash table capacity overflow"), + Fallible => CollectionAllocErr::CapacityOverflow, + Infallible => panic!("Hash table capacity overflow"), } } /// Error to return on allocation error. #[inline] fn alloc_err(self, layout: Layout) -> CollectionAllocErr { + use Fallibility::*; match self { - Fallibility::Fallible => CollectionAllocErr::AllocErr { layout }, - Fallibility::Infallible => handle_alloc_error(layout), + Fallible => CollectionAllocErr::AllocErr { layout }, + Infallible => handle_alloc_error(layout), } } }