From 01e0f8d018f016b3571f8ade46171efbd96295b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 8 Dec 2018 23:51:20 +0100 Subject: [PATCH] Only store DeadlockData if feature is activated --- core/src/parking_lot.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs index 69904cd1..ff663a9b 100644 --- a/core/src/parking_lot.rs +++ b/core/src/parking_lot.rs @@ -136,8 +136,7 @@ struct ThreadData { parked_with_timeout: Cell, // Extra data for deadlock detection - // FIXME: once supported in stable replace with #[cfg...] & remove dummy struct/impl - #[allow(dead_code)] + #[cfg(feature = "deadlock_detection")] deadlock_data: deadlock::DeadlockData, } @@ -157,6 +156,7 @@ impl ThreadData { unpark_token: Cell::new(DEFAULT_UNPARK_TOKEN), park_token: Cell::new(DEFAULT_PARK_TOKEN), parked_with_timeout: Cell::new(false), + #[cfg(feature = "deadlock_detection")] deadlock_data: deadlock::DeadlockData::new(), } } @@ -1109,16 +1109,6 @@ pub mod deadlock { #[cfg(feature = "deadlock_detection")] pub(super) use super::deadlock_impl::DeadlockData; - #[cfg(not(feature = "deadlock_detection"))] - pub(super) struct DeadlockData {} - - #[cfg(not(feature = "deadlock_detection"))] - impl DeadlockData { - pub(super) fn new() -> Self { - DeadlockData {} - } - } - /// Acquire a resource identified by key in the deadlock detector /// Noop if deadlock_detection feature isn't enabled. /// Note: Call after the resource is acquired