From c0c9472d624493b9d72dd14951ee0c9ca3296a41 Mon Sep 17 00:00:00 2001 From: Changgyoo Park Date: Fri, 11 Oct 2024 17:08:12 +0200 Subject: [PATCH] chore(*): adjust non-miri-friendly assertion condition --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- src/hash_table/bucket_array.rs | 2 +- src/tree_index/node.rs | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69f4281..c4e222b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Version 2 +2.2.1 + +* Fix a minor Miri specific assertion failure. + 2.2.0 * Add `Comparable` and `Equivalent` traits: [#162](https://github.com/wvwwvwwv/scalable-concurrent-containers/issues/162) by [qthree](https://github.com/qthree). diff --git a/Cargo.toml b/Cargo.toml index 54105b8..220144e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "scc" description = "High performance containers and utilities for concurrent and asynchronous programming" documentation = "https://docs.rs/scc" -version = "2.2.0" +version = "2.2.1" authors = ["wvwwvwwv "] edition = "2021" rust-version = "1.65.0" diff --git a/src/hash_table/bucket_array.rs b/src/hash_table/bucket_array.rs index 59c3b20..a5404dd 100644 --- a/src/hash_table/bucket_array.rs +++ b/src/hash_table/bucket_array.rs @@ -92,7 +92,7 @@ impl BucketArray { bucket_array_ptr_offset + bucket_size * array_len <= bucket_array_allocation_size, ); assert_eq!( - (bucket_array_ptr as usize + bucket_array_ptr_offset) % bucket_size, + (bucket_array_ptr as usize + bucket_array_ptr_offset) % bucket_size.next_power_of_two(), 0 ); diff --git a/src/tree_index/node.rs b/src/tree_index/node.rs index 718f695..dd6e12e 100644 --- a/src/tree_index/node.rs +++ b/src/tree_index/node.rs @@ -6,7 +6,7 @@ use crate::wait_queue::DeriveAsyncWait; use crate::Comparable; use std::fmt::{self, Debug}; use std::ops::RangeBounds; -use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release}; +use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed}; /// [`Node`] is either [`Self::Internal`] or [`Self::Leaf`]. pub enum Node { @@ -224,8 +224,8 @@ where match root.compare_exchange( root_ptr, (Some(new_root), Tag::None), - Release, - Relaxed, + AcqRel, + Acquire, guard, ) { Ok((old_root, new_root_ptr)) => {