Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dependencies and deprecated functions #99

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "flurry"
version = "0.3.1"
authors = ["Jon Gjengset <[email protected]>"]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"

readme = "README.md"
Expand All @@ -20,17 +20,17 @@ codecov = { repository = "jonhoo/flurry", branch = "master", service = "github"
maintenance = { status = "experimental" }

[features]
sanitize = ['crossbeam-epoch/sanitize']
#sanitize = ['crossbeam-epoch/sanitize']

[dependencies]
crossbeam-epoch = "0.8.2"
parking_lot = "0.10"
num_cpus = "1.12.0"
rayon = {version = "1.3", optional = true}
crossbeam-epoch = "0.9"
parking_lot = "0.11"
num_cpus = "1.13"
rayon = {version = "1.5", optional = true}
serde = {version = "1.0.105", optional = true}

[dependencies.ahash]
version = "0.3.2"
version = "0.7.6"
default-features = false

[dev-dependencies]
Expand Down
198 changes: 99 additions & 99 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
jobs:
- template: default.yml@templates
parameters:
minrust: 1.49.0 # std::hint::spin_loop
- job: deny
displayName: "Disallowed attributes"
pool:
vmImage: ubuntu-latest
steps:
# Work around https://github.com/microsoft/azure-pipelines-tasks/issues/12179
- bash: |
sudo rm -r /usr/share/rust/.cargo/bin
displayName: Remove .cargo/bin so we can restore it from cache
- task: Cache@2
inputs:
key: cargo-deny | $(Agent.OS)
path: /usr/share/rust/.cargo/bin
cacheHitVar: CACHE_RESTORED
- bash: |
find -D exec /usr/share/rust/.cargo/bin ! -name 'cargo-deny' -type f -exec rm {} +
displayName: Only rely on cached cargo-deny
condition: eq(variables.CACHE_RESTORED, 'true')
- template: install-rust.yml@templates
parameters:
rust: stable
- script: cargo install cargo-deny
displayName: install cargo-deny
condition: ne(variables.CACHE_RESTORED, 'true')
- script: cargo deny check
displayName: cargo deny
- job: canary
displayName: "Warning screening"
dependsOn: deny
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: beta
components:
- clippy
- bash: cargo clippy --all-features -- -D warnings
displayName: cargo clippy -- -D warnings
- job: miri
displayName: "Run miri on test suite"
dependsOn: deny
pool:
vmImage: ubuntu-latest
steps:
- bash: |
echo '##vso[task.setvariable variable=nightly]nightly-'$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
displayName: "Determine latest miri nightly"
- template: install-rust.yml@templates
parameters:
rust: $(nightly)
components:
- miri
- script: cargo miri test
displayName: cargo miri test
env:
MIRIFLAGS: -Zmiri-ignore-leaks
- job: asan
dependsOn: deny
displayName: "Run address sanitizer on test suite"
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: nightly
- bash: |
sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
displayName: Enable debug symbols
# only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945
- script: |
env ASAN_OPTIONS="detect_odr_violation=0" RUSTFLAGS="-Z sanitizer=address" cargo test --lib --tests --all-features --target x86_64-unknown-linux-gnu
displayName: cargo -Z sanitizer=address test
- job: lsan
dependsOn: deny
displayName: "Run leak sanitizer on test suite"
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: nightly
- bash: |
sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
sed -i '/\[features\]/i [profile.dev]' Cargo.toml
sed -i '/profile.dev/a opt-level = 1' Cargo.toml
cat Cargo.toml
displayName: Enable debug symbols
- script: |
env RUSTFLAGS="-Z sanitizer=leak" cargo test --all-features --target x86_64-unknown-linux-gnu
displayName: cargo -Z sanitizer=leak test
- template: coverage.yml@templates
parameters:
token: $(CODECOV_TOKEN_SECRET)
nightly: true
doctests: true
- template: default.yml@templates
parameters:
minrust: 1.56.0 # std::hint::spin_loop
- job: deny
displayName: "Disallowed attributes"
pool:
vmImage: ubuntu-latest
steps:
# Work around https://github.com/microsoft/azure-pipelines-tasks/issues/12179
- bash: |
sudo rm -r /usr/share/rust/.cargo/bin
displayName: Remove .cargo/bin so we can restore it from cache
- task: Cache@2
inputs:
key: cargo-deny | $(Agent.OS)
path: /usr/share/rust/.cargo/bin
cacheHitVar: CACHE_RESTORED
- bash: |
find -D exec /usr/share/rust/.cargo/bin ! -name 'cargo-deny' -type f -exec rm {} +
displayName: Only rely on cached cargo-deny
condition: eq(variables.CACHE_RESTORED, 'true')
- template: install-rust.yml@templates
parameters:
rust: stable
- script: cargo install cargo-deny
displayName: install cargo-deny
condition: ne(variables.CACHE_RESTORED, 'true')
- script: cargo deny check
displayName: cargo deny
- job: canary
displayName: "Warning screening"
dependsOn: deny
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: beta
components:
- clippy
- bash: cargo clippy --all-features -- -D warnings
displayName: cargo clippy -- -D warnings
- job: miri
displayName: "Run miri on test suite"
dependsOn: deny
pool:
vmImage: ubuntu-latest
steps:
- bash: |
echo '##vso[task.setvariable variable=nightly]nightly-'$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
displayName: "Determine latest miri nightly"
- template: install-rust.yml@templates
parameters:
rust: $(nightly)
components:
- miri
- script: cargo miri test
displayName: cargo miri test
env:
MIRIFLAGS: -Zmiri-ignore-leaks
- job: asan
dependsOn: deny
displayName: "Run address sanitizer on test suite"
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: nightly
- bash: |
sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
displayName: Enable debug symbols
# only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945
- script: |
env ASAN_OPTIONS="detect_odr_violation=0" RUSTFLAGS="-Z sanitizer=address" cargo test --lib --tests --all-features --target x86_64-unknown-linux-gnu
displayName: cargo -Z sanitizer=address test
- job: lsan
dependsOn: deny
displayName: "Run leak sanitizer on test suite"
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: nightly
- bash: |
sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
sed -i '/\[features\]/i [profile.dev]' Cargo.toml
sed -i '/profile.dev/a opt-level = 1' Cargo.toml
cat Cargo.toml
displayName: Enable debug symbols
- script: |
env RUSTFLAGS="-Z sanitizer=leak" cargo test --all-features --target x86_64-unknown-linux-gnu
displayName: cargo -Z sanitizer=leak test
- template: coverage.yml@templates
parameters:
token: $(CODECOV_TOKEN_SECRET)
nightly: true
doctests: true

resources:
repositories:
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
missing_docs,
missing_debug_implementations,
unreachable_pub,
broken_intra_doc_links
rustdoc::broken_intra_doc_links
)]
#![warn(rust_2018_idioms)]
#![allow(clippy::cognitive_complexity)]
Expand Down
7 changes: 4 additions & 3 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ impl<K, V> Table<K, V> {
t if t.is_null() => {
// if a no next table is yet associated with this table,
// create one and store it in `self.next_table`
match self.next_table.compare_and_set(
match self.next_table.compare_exchange(
Shared::null(),
for_table,
Ordering::SeqCst,
Ordering::SeqCst,
guard,
) {
Ok(_) => {}
Expand Down Expand Up @@ -311,12 +312,12 @@ impl<K, V> Table<K, V> {
guard: &'g Guard,
) -> Result<
Shared<'g, BinEntry<K, V>>,
crossbeam_epoch::CompareAndSetError<'g, BinEntry<K, V>, P>,
crossbeam_epoch::CompareExchangeError<'g, BinEntry<K, V>, P>,
>
where
P: Pointer<BinEntry<K, V>>,
{
self.bins[i].compare_and_set(current, new, Ordering::AcqRel, guard)
self.bins[i].compare_exchange(current, new, Ordering::AcqRel, Ordering::Acquire, guard)
}

#[inline]
Expand Down
19 changes: 14 additions & 5 deletions tests/cuckoo/stress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ impl Environment {
vals1: Mutex::new(vec![0usize; NUM_KEYS]),
vals2: Mutex::new(vec![0usize; NUM_KEYS]),
ind_dist: Uniform::from(0..NUM_KEYS - 1),
val_dist1: Uniform::from(Value::min_value()..Value::max_value()),
val_dist2: Uniform::from(Value::min_value()..Value::max_value()),
val_dist1: Uniform::from(Value::MIN..Value::MAX),
val_dist2: Uniform::from(Value::MIN..Value::MAX),
in_table: Mutex::new(vec![false; NUM_KEYS]),
in_use: Mutex::new(in_use),
finished: AtomicBool::new(false),
Expand All @@ -65,7 +65,10 @@ fn stress_insert_thread(env: Arc<Environment>) {
while !env.finished.load(Ordering::SeqCst) {
let idx = env.ind_dist.sample(&mut rng);
let in_use = env.in_use.lock();
if (*in_use)[idx].compare_and_swap(false, true, Ordering::SeqCst) {
if (*in_use)[idx]
.compare_exchange_weak(false, true, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
let key = env.keys[idx];
let val1 = env.val_dist1.sample(&mut rng);
let val2 = env.val_dist2.sample(&mut rng);
Expand Down Expand Up @@ -102,7 +105,10 @@ fn stress_delete_thread(env: Arc<Environment>) {
while !env.finished.load(Ordering::SeqCst) {
let idx = env.ind_dist.sample(&mut rng);
let in_use = env.in_use.lock();
if (*in_use)[idx].compare_and_swap(false, true, Ordering::SeqCst) {
if (*in_use)[idx]
.compare_exchange_weak(false, true, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
let key = env.keys[idx];
let res1 = env.table1.remove(&key, &guard).map_or(false, |_| true);
let res2 = env.table2.remove(&key, &guard).map_or(false, |_| true);
Expand All @@ -125,7 +131,10 @@ fn stress_find_thread(env: Arc<Environment>) {
while !env.finished.load(Ordering::SeqCst) {
let idx = env.ind_dist.sample(&mut rng);
let in_use = env.in_use.lock();
if (*in_use)[idx].compare_and_swap(false, true, Ordering::SeqCst) {
if (*in_use)[idx]
.compare_exchange_weak(false, true, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
let key = env.keys[idx];
let in_table = env.in_table.lock();
let val1 = (*env.vals1.lock())[idx];
Expand Down