From 8ec32bdf161afd700e29500c01e2d15badc41c70 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 10 Apr 2025 19:12:33 +0200 Subject: [PATCH] Reorganise features Now the features do not directly enable each other, which should silence extraneous deprecation warnings while running tests. This can be cleaned up in the next BC break when the old features are removed. --- Cargo.toml | 4 ++-- src/lib.rs | 26 ++++++++++---------------- src/lockapi.rs | 1 + 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2d6fabc..5936c39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,8 +42,8 @@ lock_api = ["dep:lock_api"] parking_lot = ["dep:parking_lot", "lock_api"] # Deprecated feature names from when cargo couldn't distinguish between dep and feature -lockapi = ["lock_api"] -parkinglot = ["parking_lot"] +lockapi = ["dep:lock_api"] +parkinglot = ["dep:parking_lot", "lock_api"] [build-dependencies] autocfg = "1.4.0" diff --git a/src/lib.rs b/src/lib.rs index a839565..185da76 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,36 +85,30 @@ use std::sync::OnceLock; use std::sync::PoisonError; #[cfg(feature = "lock_api")] -#[cfg_attr(docsrs, doc(cfg(feature = "lock_api")))] -#[cfg_attr( - all(not(docsrs), feature = "lockapi"), - deprecated = "The `lockapi` feature has been renamed `lock_api`" -)] +#[cfg_attr(docsrs, doc(cfg(feature = "lockapi")))] +#[deprecated = "The top-level re-export `lock_api` is deprecated. Use `tracing_mutex::lockapi::raw` instead"] pub use lock_api; #[cfg(feature = "parking_lot")] -#[cfg_attr(docsrs, doc(cfg(feature = "parking_lot")))] -#[cfg_attr( - all(not(docsrs), feature = "parkinglot"), - deprecated = "The `parkinglot` feature has been renamed `parking_lot`" -)] +#[cfg_attr(docsrs, doc(cfg(feature = "parkinglot")))] +#[deprecated = "The top-level re-export `parking_lot` is deprecated. Use `tracing_mutex::parkinglot::raw` instead"] pub use parking_lot; + +use graph::DiGraph; use reporting::Dep; use reporting::Reportable; -use crate::graph::DiGraph; - mod graph; -#[cfg(feature = "lock_api")] +#[cfg(any(feature = "lock_api", feature = "lockapi"))] #[cfg_attr(docsrs, doc(cfg(feature = "lock_api")))] #[cfg_attr( - all(not(docsrs), feature = "lockapi"), + all(not(docsrs), feature = "lockapi", not(feature = "lock_api")), deprecated = "The `lockapi` feature has been renamed `lock_api`" )] pub mod lockapi; -#[cfg(feature = "parking_lot")] +#[cfg(any(feature = "parking_lot", feature = "parkinglot"))] #[cfg_attr(docsrs, doc(cfg(feature = "parking_lot")))] #[cfg_attr( - all(not(docsrs), feature = "parkinglot"), + all(not(docsrs), feature = "parkinglot", not(feature = "parking_lot")), deprecated = "The `parkinglot` feature has been renamed `parking_lot`" )] pub mod parkinglot; diff --git a/src/lockapi.rs b/src/lockapi.rs index 5565d53..afd4fa7 100644 --- a/src/lockapi.rs +++ b/src/lockapi.rs @@ -8,6 +8,7 @@ //! Wrapped mutexes are at least one `usize` larger than the types they wrapped, and must be aligned //! to `usize` boundaries. As such, libraries with many mutexes may want to consider the additional //! required memory. +pub use lock_api as raw; use lock_api::GuardNoSend; use lock_api::RawMutex; use lock_api::RawMutexFair;