Skip to content

Commit 74ec7c5

Browse files
committed
Merge branch 'master' of github.com:tkaitchuck/hashbrown
2 parents ce1e584 + 83ce3d5 commit 74ec7c5

File tree

24 files changed

+1881
-891
lines changed

24 files changed

+1881
-891
lines changed

.travis.yml

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,71 @@
11
language: rust
22
sudo: false
3+
rust: nightly
34

45
matrix:
56
include:
67
- name: "miri"
7-
rust: nightly
8-
install:
9-
- rustup component add rust-src
10-
- cargo +nightly install --force --git https://github.com/rust-lang/miri miri
11-
- cargo install xargo
12-
script:
13-
- cargo clean
14-
- cargo +nightly miri test
15-
- rust: 1.29.0
16-
- rust: stable
17-
- rust: beta
18-
- rust: nightly
19-
- rust: nightly
20-
env:
21-
- FEATURES='nightly'
8+
env: TARGET=x86_64-unknown-linux-gnu
9+
script: sh ci/miri.sh
10+
- name: "rustfmt/clippy"
11+
env: TARGET=i586-unknown-linux-gnu
12+
script: sh ci/tools.sh
13+
- name: "docs"
14+
env: TARGET=x86_64-unknown-linux-gnu
15+
script: cargo -vv doc --features nightly,serde,rayon
16+
deploy:
17+
provider: pages
18+
skip-cleanup: true
19+
github-token: $GITHUB_TOKEN
20+
local-dir: target/doc
21+
keep-history: false
22+
on:
23+
branch: master
2224

23-
# test a target without sse2 for raw/generic.rs
24-
- rust: stable
25-
env:
26-
- TARGET=i586-unknown-linux-gnu
27-
addons:
28-
apt:
29-
packages:
30-
- gcc-multilib
31-
install:
32-
- rustup target add $TARGET
33-
script:
34-
- cargo build --verbose --target $TARGET
35-
- cargo test --verbose --target $TARGET
25+
# Tier 1 targets:
26+
- name: "x86_64-unknown-linux-gnu"
27+
env: TARGET=x86_64-unknown-linux-gnu
28+
- name: "x86_64-unknown-linux-gnu (beta)"
29+
rust: beta
30+
env: TARGET=x86_64-unknown-linux-gnu
31+
- name: "x86_64-unknown-linux-gnu (stable)"
32+
rust: stable
33+
env: TARGET=x86_64-unknown-linux-gnu
34+
- name: "x86_64-unknown-linux-gnu (Rust 1.31.0)"
35+
rust: 1.31.0
36+
env: TARGET=x86_64-unknown-linux-gnu
37+
- name: "i686-unknown-linux-gnu"
38+
env: TARGET=i686-unknown-linux-gnu CROSS=1
39+
- name: "x86_64-apple-darwin"
40+
env: TARGET=x86_64-apple-darwin
41+
os: osx
42+
osx_image: xcode10
43+
- name: "i686-apple-darwin"
44+
env: TARGET=i686-apple-darwin
45+
os: osx
46+
osx_image: xcode10
47+
- name: "x86_64-pc-windows-msvc"
48+
env: TARGET=x86_64-pc-windows-msvc
49+
os: windows
50+
- name: "x86_64-pc-windows-gnu"
51+
env: TARGET=x86_64-pc-windows-gnu CROSS=1
52+
- name: "i686-pc-windows-gnu"
53+
env: TARGET=i686-pc-windows-gnu CROSS=1
54+
55+
# Tier 2/3 targets:
56+
- name: "i586-unknown-linux-gnu (no SSE2)"
57+
env: TARGET=i586-unknown-linux-gnu CROSS=1
58+
- name: "armv7-unknown-linux-gnueabihf"
59+
env: TARGET=armv7-unknown-linux-gnueabihf CROSS=1
60+
- name: "aarch64-unknown-linux-gnu"
61+
env: TARGET=aarch64-unknown-linux-gnu CROSS=1
62+
63+
install: travis_retry rustup target add "${TARGET}"
64+
script: sh ci/run.sh
3665

3766
branches:
3867
# Don't build these branches
3968
except:
4069
# Used by bors
4170
- trying.tmp
4271
- staging.tmp
43-
44-
before_script:
45-
- if [ "$TRAVIS_RUST_VERSION" == "stable" ]; then rustup component add rustfmt; fi
46-
47-
script:
48-
- if [ "$TRAVIS_RUST_VERSION" == "stable" ]; then cargo fmt -- --check; fi
49-
50-
- cargo build --verbose --features "$FEATURES"
51-
- cargo test --verbose --features "$FEATURES"
52-
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo bench --verbose --features "$FEATURES"; fi
53-
- cargo doc --verbose --features "$FEATURES"
54-
55-
- cargo build --verbose --features "$FEATURES serde"
56-
- cargo test --verbose --features "$FEATURES serde"
57-
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo bench --verbose --features "$FEATURES serde"; fi
58-
- cargo doc --verbose --features "$FEATURES serde"

Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ readme = "README.md"
99
keywords = ["hash", "no_std", "hashmap", "swisstable"]
1010
categories = ["data-structures", "no-std"]
1111
exclude = [".travis.yml", "bors.toml"]
12+
edition = "2018"
1213

1314
[dependencies]
14-
byteorder = { version = "1.0", default-features = false }
15-
scopeguard = { version = "0.3", default-features = false }
16-
1715
# For external trait impls
1816
rayon = { version = "1.0", optional = true }
1917
serde = { version = "1.0.25", default-features = false, optional = true }
2018

19+
# When built as part of libstd
20+
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
21+
compiler_builtins = { version = "0.1.2", optional = true }
22+
alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" }
23+
2124
[dev-dependencies]
2225
lazy_static = "~1.2"
2326
rand = "0.5.1"
@@ -26,4 +29,6 @@ rustc-hash = "1.0"
2629
serde_test = "1.0"
2730

2831
[features]
32+
default = []
2933
nightly = []
34+
rustc-dep-of-std = ["nightly", "core", "compiler_builtins", "alloc"]

benches/bench.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![feature(test)]
22

3-
extern crate hashbrown;
4-
extern crate rustc_hash;
53
extern crate test;
64

75
use std::hash::Hash;

ci/miri.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
export CARGO_NET_RETRY=5
6+
export CARGO_NET_TIMEOUT=10
7+
8+
if rustup component add miri ; then
9+
cargo miri setup
10+
cargo miri test -- -- -Zunstable-options --exclude-should-panic
11+
fi

ci/run.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
: "${TARGET?The TARGET environment variable must be set.}"
6+
7+
FEATURES="rayon,serde"
8+
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then
9+
FEATURES="${FEATURES},nightly"
10+
export RUSTFLAGS="$RUSTFLAGS -D warnings"
11+
fi
12+
13+
CARGO=cargo
14+
if [ "${CROSS}" = "1" ]; then
15+
export CARGO_NET_RETRY=5
16+
export CARGO_NET_TIMEOUT=10
17+
18+
cargo install cross
19+
CARGO=cross
20+
fi
21+
22+
export RUSTFLAGS="$RUSTFLAGS --cfg hashbrown_deny_warnings"
23+
24+
"${CARGO}" -vv test --target="${TARGET}"
25+
"${CARGO}" -vv test --target="${TARGET}" --features "${FEATURES}"
26+
27+
"${CARGO}" -vv test --target="${TARGET}" --release
28+
"${CARGO}" -vv test --target="${TARGET}" --release --features "${FEATURES}"
29+
30+
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then
31+
# Run benchmark on native targets, build them on non-native ones:
32+
NO_RUN=""
33+
if [ "${CROSS}" = "1" ]; then
34+
NO_RUN="--no-run"
35+
fi
36+
37+
"${CARGO}" -vv bench "${NO_RUN}" --features "${FEATURES}"
38+
fi

ci/tools.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
retry() {
6+
result=0
7+
count=1
8+
max=5
9+
while [ "$count" -le 3 ]; do
10+
[ "$result" -ne 0 ] && {
11+
printf "\nRetrying, %d of %d\n" $count $max >&2
12+
}
13+
"$@"
14+
result=$?
15+
[ $result -eq 0 ] && break
16+
count=$(count + 1)
17+
sleep 1
18+
done
19+
20+
[ "$count" -gt 3 ] && {
21+
printf "\nFailed %d times.\n" $max >&2
22+
}
23+
24+
return $result
25+
}
26+
27+
28+
if retry rustup component add rustfmt ; then
29+
cargo fmt --all -- --check
30+
fi
31+
32+
if retry rustup component add clippy ; then
33+
cargo clippy --all -- -D clippy::pedantic
34+
fi
35+
36+
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
37+
if retry rustup component add clippy ; then
38+
cargo clippy --all --target=i586-unknown-linux-gnu -- -D clippy::pedantic
39+
fi
40+
fi
41+
42+
if command -v shellcheck ; then
43+
shellcheck --version
44+
shellcheck ci/*.sh
45+
fi

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
doc-valid-idents = [ "CppCon", "SwissTable", "SipHash", "HashDoS" ]

0 commit comments

Comments
 (0)