From f85462916feca9600ae24540ba5699eb8cb6fefb Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sat, 7 Sep 2024 13:07:42 +0100 Subject: [PATCH 1/3] [sync] Update to DashMap 6 --- Cargo.toml | 2 +- src/sync/base_cache.rs | 4 ++-- src/sync/cache.rs | 2 +- src/sync/iter.rs | 2 +- src/sync/mapref.rs | 22 ++++++++-------------- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 91d06e0..9fb8ffc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ tagptr = "0.2" triomphe = { version = ">=0.1.3, <0.1.12", default-features = false } # Optional dependencies (enabled by default) -dashmap = { version = "5.2", optional = true } +dashmap = { version = "6.1", optional = true } [dev-dependencies] anyhow = "1.0.19" diff --git a/src/sync/base_cache.rs b/src/sync/base_cache.rs index ff47997..3c9cb90 100644 --- a/src/sync/base_cache.rs +++ b/src/sync/base_cache.rs @@ -477,7 +477,7 @@ enum AdmissionResult { type CacheStore = dashmap::DashMap, TrioArc>, S>; -type CacheEntryRef<'a, K, V, S> = DashMapRef<'a, Arc, TrioArc>, S>; +type CacheEntryRef<'a, K, V> = DashMapRef<'a, Arc, TrioArc>>; // Define a type alias to avoid clippy::type_complexity warnings. type RemovedEntry = (Arc, TrioArc>); @@ -583,7 +583,7 @@ where } #[inline] - fn get(&self, key: &Q) -> Option> + fn get(&self, key: &Q) -> Option> where Arc: Borrow, Q: Hash + Eq + ?Sized, diff --git a/src/sync/cache.rs b/src/sync/cache.rs index 2a7f244..5f7fbd9 100644 --- a/src/sync/cache.rs +++ b/src/sync/cache.rs @@ -586,7 +586,7 @@ where V: 'a, S: BuildHasher + Clone, { - type Item = EntryRef<'a, K, V, S>; + type Item = EntryRef<'a, K, V>; type IntoIter = Iter<'a, K, V, S>; diff --git a/src/sync/iter.rs b/src/sync/iter.rs index f8bf65f..6d3290c 100644 --- a/src/sync/iter.rs +++ b/src/sync/iter.rs @@ -26,7 +26,7 @@ where K: Eq + Hash, S: BuildHasher + Clone, { - type Item = EntryRef<'a, K, V, S>; + type Item = EntryRef<'a, K, V>; fn next(&mut self) -> Option { for map_ref in &mut self.map_iter { diff --git a/src/sync/mapref.rs b/src/sync/mapref.rs index 0800406..8fa1411 100644 --- a/src/sync/mapref.rs +++ b/src/sync/mapref.rs @@ -1,30 +1,25 @@ use crate::common::concurrent::ValueEntry; -use std::{ - hash::{BuildHasher, Hash}, - sync::Arc, -}; +use std::{hash::Hash, sync::Arc}; use triomphe::Arc as TrioArc; -type DashMapRef<'a, K, V, S> = - dashmap::mapref::multiple::RefMulti<'a, Arc, TrioArc>, S>; +type DashMapRef<'a, K, V> = + dashmap::mapref::multiple::RefMulti<'a, Arc, TrioArc>>; -pub struct EntryRef<'a, K, V, S>(DashMapRef<'a, K, V, S>); +pub struct EntryRef<'a, K, V>(DashMapRef<'a, K, V>); -unsafe impl<'a, K, V, S> Sync for EntryRef<'a, K, V, S> +unsafe impl<'a, K, V> Sync for EntryRef<'a, K, V> where K: Eq + Hash + Send + Sync, V: Send + Sync, - S: BuildHasher, { } -impl<'a, K, V, S> EntryRef<'a, K, V, S> +impl<'a, K, V> EntryRef<'a, K, V> where K: Eq + Hash, - S: BuildHasher + Clone, { - pub(crate) fn new(map_ref: DashMapRef<'a, K, V, S>) -> Self { + pub(crate) fn new(map_ref: DashMapRef<'a, K, V>) -> Self { Self(map_ref) } @@ -41,10 +36,9 @@ where } } -impl<'a, K, V, S> std::ops::Deref for EntryRef<'a, K, V, S> +impl<'a, K, V> std::ops::Deref for EntryRef<'a, K, V> where K: Eq + Hash, - S: BuildHasher + Clone, { type Target = V; From 965447a687d936594e5c596cc082d19ab5a1ef3f Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sun, 8 Sep 2024 11:45:58 +0100 Subject: [PATCH 2/3] Bump MSRV to 1.76 --- .ci_extras/pin-crate-vers-msrv.sh | 6 ----- .github/workflows/CI.yml | 6 +---- .github/workflows/LinuxCrossCompileTest.yml | 26 ++++++++++----------- Cargo.toml | 5 ++-- README.md | 2 +- src/lib.rs | 2 +- 6 files changed, 18 insertions(+), 29 deletions(-) delete mode 100755 .ci_extras/pin-crate-vers-msrv.sh diff --git a/.ci_extras/pin-crate-vers-msrv.sh b/.ci_extras/pin-crate-vers-msrv.sh deleted file mode 100755 index a783b4d..0000000 --- a/.ci_extras/pin-crate-vers-msrv.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -eux - -# Pin some dependencies to specific versions for the MSRV. -cargo update -p dashmap --precise 5.4.0 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7843cbf..68569d8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,7 +24,7 @@ jobs: rust: - stable - beta - - 1.61.0 # MSRV + - 1.76.0 # MSRV - nightly # For checking minimum version dependencies. steps: @@ -42,10 +42,6 @@ jobs: if: ${{ matrix.rust == 'nightly' }} run: cargo update -Z minimal-versions - - name: Pin some dependencies to specific versions (MSRV only) - if: ${{ matrix.rust == '1.61.0' }} - run: ./.ci_extras/pin-crate-vers-msrv.sh - - name: Show cargo tree run: cargo tree diff --git a/.github/workflows/LinuxCrossCompileTest.yml b/.github/workflows/LinuxCrossCompileTest.yml index 162d8ec..65293a5 100644 --- a/.github/workflows/LinuxCrossCompileTest.yml +++ b/.github/workflows/LinuxCrossCompileTest.yml @@ -3,19 +3,19 @@ name: Linux cross compile tests on: push: paths-ignore: - - '.devcontainer/**' - - '.gitpod.yml' - - '.vscode/**' - - 'tests/**' + - ".devcontainer/**" + - ".gitpod.yml" + - ".vscode/**" + - "tests/**" pull_request: paths-ignore: - - '.devcontainer/**' - - '.gitpod.yml' - - '.vscode/**' - - 'tests/**' + - ".devcontainer/**" + - ".gitpod.yml" + - ".vscode/**" + - "tests/**" schedule: # Run against the last commit on the default branch on Friday at 9pm (UTC?) - - cron: '0 21 * * 5' + - cron: "0 21 * * 5" jobs: linux-cross: @@ -33,11 +33,11 @@ jobs: - target: armv5te-unknown-linux-musleabi rust-version: stable - target: mips-unknown-linux-musl - rust-version: "1.72.1" - cargo-version: "+1.72.1" + rust-version: "1.76" + cargo-version: "+1.76" - target: mipsel-unknown-linux-musl - rust-version: "1.72.1" - cargo-version: "+1.72.1" + rust-version: "1.76" + cargo-version: "+1.76" steps: - name: Checkout Mini Moka diff --git a/Cargo.toml b/Cargo.toml index 9fb8ffc..8ab1b11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "mini-moka" version = "0.10.3" edition = "2018" -rust-version = "1.61" +rust-version = "1.76" description = "A lighter edition of Moka, a fast and concurrent cache library" license = "MIT OR Apache-2.0" @@ -29,8 +29,7 @@ tagptr = "0.2" # Opt-out serde and stable_deref_trait features # https://github.com/Manishearth/triomphe/pull/5 -# 0.1.12 requires Rust 1.76 -triomphe = { version = ">=0.1.3, <0.1.12", default-features = false } +triomphe = { version = "0.1.13", default-features = false } # Optional dependencies (enabled by default) dashmap = { version = "6.1", optional = true } diff --git a/README.md b/README.md index 9609f7a..2175fa6 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ Mini Moka's minimum supported Rust versions (MSRV) are the followings: | Feature | MSRV | |:-----------------|:--------------------------:| -| default features | Rust 1.61.0 (May 19, 2022) | +| default features | Rust 1.76.0 (Feb 8, 2024) | It will keep a rolling MSRV policy of at least 6 months. If only the default features are enabled, MSRV will be updated conservatively. When using other features, MSRV diff --git a/src/lib.rs b/src/lib.rs index 670ef12..792f5c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,7 +51,7 @@ //! //! | Feature | MSRV | //! |:-----------------|:--------------------------:| -//! | default features | Rust 1.61.0 (May 19, 2022) | +//! | default features | Rust 1.76.0 (Feb 8, 2024) | //! //! If only the default features are enabled, MSRV will be updated conservatively. //! When using other features, MSRV might be updated more frequently, up to the From 309fa895f8c56ad32715c66b766fcd1ba648a32a Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sun, 8 Sep 2024 12:09:06 +0100 Subject: [PATCH 3/3] Remove CI for no longer supported MIPs targets --- .github/workflows/LinuxCrossCompileTest.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/LinuxCrossCompileTest.yml b/.github/workflows/LinuxCrossCompileTest.yml index 65293a5..00af150 100644 --- a/.github/workflows/LinuxCrossCompileTest.yml +++ b/.github/workflows/LinuxCrossCompileTest.yml @@ -32,12 +32,6 @@ jobs: rust-version: stable - target: armv5te-unknown-linux-musleabi rust-version: stable - - target: mips-unknown-linux-musl - rust-version: "1.76" - cargo-version: "+1.76" - - target: mipsel-unknown-linux-musl - rust-version: "1.76" - cargo-version: "+1.76" steps: - name: Checkout Mini Moka