From 4143cc0a68469fc42a304ff22930bacd443d77a0 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Wed, 7 Jun 2023 09:32:15 +0800 Subject: [PATCH] Update the change log and source code comments --- CHANGELOG.md | 8 ++++++++ src/cht/map/bucket.rs | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbac56a5..2f7e8698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ Bumped the minimum supported Rust version (MSRV) to 1.65 (Nov 3, 2022). - Removed `num_cpus` crate from the dependency. ([#277][gh-pull-0277]) +### Changed + +- Refactored internal methods of the concurrent hash table to reduce compile times. + ([#265][gh-pull-0265], by [@Swatinem][gh-Swatinem]) + + ## Version 0.11.1 ### Fixed @@ -21,6 +27,7 @@ Bumped the minimum supported Rust version (MSRV) to 1.65 (Nov 3, 2022). - Added some example programs to the `examples` directory. ([#268][gh-pull-0268], by [@peter-scholtens][gh-peter-scholtens]) + ## Version 0.11.0 ### Added @@ -673,6 +680,7 @@ The minimum supported Rust version (MSRV) is now 1.51.0 (Mar 25, 2021). [gh-pull-0275]: https://github.com/moka-rs/moka/pull/275/ [gh-pull-0272]: https://github.com/moka-rs/moka/pull/272/ [gh-pull-0268]: https://github.com/moka-rs/moka/pull/268/ +[gh-pull-0265]: https://github.com/moka-rs/moka/pull/265/ [gh-pull-0259]: https://github.com/moka-rs/moka/pull/259/ [gh-pull-0251]: https://github.com/moka-rs/moka/pull/251/ [gh-pull-0248]: https://github.com/moka-rs/moka/pull/248/ diff --git a/src/cht/map/bucket.rs b/src/cht/map/bucket.rs index 3c0ea012..63ccbd86 100644 --- a/src/cht/map/bucket.rs +++ b/src/cht/map/bucket.rs @@ -401,7 +401,9 @@ impl<'g, K: 'g, V: 'g> BucketArray { fn probe(&self, guard: &'g Guard, hash: u64) -> Probe<'_, 'g, K, V> { let buckets = &self.buckets; let offset = hash as usize & (buckets.len() - 1); - // FIXME: this will panic if `len() == 0` + // SAFETY: `len()` is never be 0 so this index access will never panic. + // This invariant is ensured by the `assert!()` at the beginning of + // `with_length()` because 0 is not a power of two. let this_bucket = (offset, &buckets[offset]); Probe { buckets,