diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52a7ab1..b78d0f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: strategy: matrix: rust: + - "1.74" # Current minimum for experimental features - stable - beta - nightly @@ -44,7 +45,8 @@ jobs: with: toolchain: "1.70" - - run: cargo test --all-features + # Test everything except experimental features. + - run: cargo test --features backtraces,lockapi,parkinglot docs: name: Documentation build diff --git a/Cargo.toml b/Cargo.toml index fc8bf29..8a1fc88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ required-features = ["parkinglot"] [features] default = ["backtraces"] backtraces = [] +experimental = [] # Feature names do not match crate names pending namespaced features. lockapi = ["lock_api"] parkinglot = ["parking_lot", "lockapi"] diff --git a/src/util.rs b/src/util.rs index 6e12432..f4ea6a3 100644 --- a/src/util.rs +++ b/src/util.rs @@ -37,6 +37,8 @@ use crate::MutexId; /// let _second_lock = second.lock().unwrap(); /// first.lock().unwrap(); /// ``` +#[cfg(feature = "experimental")] +#[cfg_attr(docsrs, doc(cfg(feature = "experimental")))] pub unsafe fn reset_dependencies(traced: &T) { crate::get_dependency_graph().remove_node(traced.get_id().value()); } @@ -45,14 +47,19 @@ pub unsafe fn reset_dependencies(traced: &T) { /// /// This trait is a public marker trait and is automatically implemented fore all types that /// implement the internal dependency tracking features. +#[cfg(feature = "experimental")] +#[cfg_attr(docsrs, doc(cfg(feature = "experimental")))] #[allow(private_bounds)] pub trait Traced: PrivateTraced {} +#[cfg(feature = "experimental")] +#[cfg_attr(docsrs, doc(cfg(feature = "experimental")))] impl Traced for T {} /// Private implementation of the traced marker. /// /// 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 { /// Get the mutex id associated with this traced item. fn get_id(&self) -> &MutexId;