From b17d716cdbc714d3d6558bcaea5e56ed02a02a7d Mon Sep 17 00:00:00 2001 From: lucasmerlin Date: Thu, 4 Sep 2025 14:32:14 +0200 Subject: [PATCH] Add track_caller to Mutex and RwLock for deadlock_detection --- crates/epaint/src/mutex.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/epaint/src/mutex.rs b/crates/epaint/src/mutex.rs index 1a043b37b..0aa823a75 100644 --- a/crates/epaint/src/mutex.rs +++ b/crates/epaint/src/mutex.rs @@ -27,6 +27,7 @@ mod mutex_impl { } #[inline(always)] + #[cfg_attr(debug_assertions, track_caller)] pub fn lock(&self) -> MutexGuard<'_, T> { if cfg!(debug_assertions) { self.0 @@ -157,6 +158,7 @@ mod rw_lock_impl { impl RwLock { #[inline(always)] + #[cfg_attr(debug_assertions, track_caller)] pub fn read(&self) -> RwLockReadGuard<'_, T> { let guard = if cfg!(debug_assertions) { self.0 @@ -169,6 +171,7 @@ mod rw_lock_impl { } #[inline(always)] + #[cfg_attr(debug_assertions, track_caller)] pub fn write(&self) -> RwLockWriteGuard<'_, T> { let guard = if cfg!(debug_assertions) { self.0