From 58756573fc5a2198f98e9b4889c494bb60f38e3d Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 7 Oct 2020 14:06:17 +0200 Subject: [PATCH] Fix comment about non-reentrant StaticMutex::lock(). The comment said it's UB to call lock() while it is locked. That'd be quite a useless Mutex. :) It was supposed to say 'locked by the same thread', not just 'locked'. --- library/std/src/sys_common/mutex.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys_common/mutex.rs b/library/std/src/sys_common/mutex.rs index 91d919a3f9b..47fa7539330 100644 --- a/library/std/src/sys_common/mutex.rs +++ b/library/std/src/sys_common/mutex.rs @@ -28,8 +28,9 @@ impl StaticMutex { /// Calls raw_lock() and then returns an RAII guard to guarantee the mutex /// will be unlocked. /// - /// It is undefined behaviour to call this function while locked, or if the - /// mutex has been moved since the last time this was called. + /// It is undefined behaviour to call this function while locked by the + /// same thread, or if the mutex has been moved since the last time this + /// was called. #[inline] pub unsafe fn lock(&self) -> StaticMutexGuard<'_> { self.0.lock();