Rework CI for experimental features

This commit is contained in:
2025-03-10 18:31:47 +01:00
parent d1a6b93ea8
commit 1ad0b2756e
3 changed files with 11 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ jobs:
strategy: strategy:
matrix: matrix:
rust: rust:
- "1.74" # Current minimum for experimental features
- stable - stable
- beta - beta
- nightly - nightly
@@ -44,7 +45,8 @@ jobs:
with: with:
toolchain: "1.70" toolchain: "1.70"
- run: cargo test --all-features # Test everything except experimental features.
- run: cargo test --features backtraces,lockapi,parkinglot
docs: docs:
name: Documentation build name: Documentation build

View File

@@ -37,6 +37,7 @@ required-features = ["parkinglot"]
[features] [features]
default = ["backtraces"] default = ["backtraces"]
backtraces = [] backtraces = []
experimental = []
# Feature names do not match crate names pending namespaced features. # Feature names do not match crate names pending namespaced features.
lockapi = ["lock_api"] lockapi = ["lock_api"]
parkinglot = ["parking_lot", "lockapi"] parkinglot = ["parking_lot", "lockapi"]

View File

@@ -37,6 +37,8 @@ use crate::MutexId;
/// let _second_lock = second.lock().unwrap(); /// let _second_lock = second.lock().unwrap();
/// first.lock().unwrap(); /// first.lock().unwrap();
/// ``` /// ```
#[cfg(feature = "experimental")]
#[cfg_attr(docsrs, doc(cfg(feature = "experimental")))]
pub unsafe fn reset_dependencies<T: Traced>(traced: &T) { pub unsafe fn reset_dependencies<T: Traced>(traced: &T) {
crate::get_dependency_graph().remove_node(traced.get_id().value()); crate::get_dependency_graph().remove_node(traced.get_id().value());
} }
@@ -45,14 +47,19 @@ pub unsafe fn reset_dependencies<T: Traced>(traced: &T) {
/// ///
/// This trait is a public marker trait and is automatically implemented fore all types that /// This trait is a public marker trait and is automatically implemented fore all types that
/// implement the internal dependency tracking features. /// implement the internal dependency tracking features.
#[cfg(feature = "experimental")]
#[cfg_attr(docsrs, doc(cfg(feature = "experimental")))]
#[allow(private_bounds)] #[allow(private_bounds)]
pub trait Traced: PrivateTraced {} pub trait Traced: PrivateTraced {}
#[cfg(feature = "experimental")]
#[cfg_attr(docsrs, doc(cfg(feature = "experimental")))]
impl<T: PrivateTraced> Traced for T {} impl<T: PrivateTraced> Traced for T {}
/// Private implementation of the traced marker. /// Private implementation of the traced marker.
/// ///
/// This trait is private (and seals the outer trait) to avoid exposing the MutexId type. /// This trait is private (and seals the outer trait) to avoid exposing the MutexId type.
#[cfg_attr(not(feature = "experimental"), allow(unused))]
pub(crate) trait PrivateTraced { pub(crate) trait PrivateTraced {
/// Get the mutex id associated with this traced item. /// Get the mutex id associated with this traced item.
fn get_id(&self) -> &MutexId; fn get_id(&self) -> &MutexId;