You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For each mutex which is currently locked, check that no mutex's locked-before
130
-
// set includes the mutex we're about to lock, which would imply a lockorder
131
-
// inversion.
132
-
for locked in held.borrow().iter(){
133
-
for locked_dep in locked.locked_before.lock().unwrap().iter(){
134
-
if*locked_dep == self.deps{
135
-
#[cfg(feature = "backtrace")]
136
-
panic!("Tried to violate existing lockorder.\nMutex that should be locked after the current lock was created at the following backtrace.\nNote that to get a backtrace for the lockorder violation, you should set RUST_BACKTRACE=1\n{:?}", locked.mutex_construction_bt);
137
-
#[cfg(not(feature = "backtrace"))]
138
-
panic!("Tried to violate existing lockorder. Build with the backtrace feature for more info.");
139
-
}
125
+
MUTEXES_HELD.with(|held| {
126
+
// For each mutex which is currently locked, check that no mutex's locked-before
127
+
// set includes the mutex we're about to lock, which would imply a lockorder
128
+
// inversion.
129
+
for locked in held.borrow().iter(){
130
+
for locked_dep in locked.locked_before.lock().unwrap().iter(){
131
+
if*locked_dep == self.deps{
132
+
#[cfg(feature = "backtrace")]
133
+
panic!("Tried to violate existing lockorder.\nMutex that should be locked after the current lock was created at the following backtrace.\nNote that to get a backtrace for the lockorder violation, you should set RUST_BACKTRACE=1\n{:?}", locked.mutex_construction_bt);
134
+
#[cfg(not(feature = "backtrace"))]
135
+
panic!("Tried to violate existing lockorder. Build with the backtrace feature for more info.");
140
136
}
141
-
// Insert any already-held mutexes in our locked-before set.
0 commit comments