File tree 1 file changed +5
-1
lines changed
library/std/src/sync/poison
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -582,7 +582,9 @@ impl<T: ?Sized> Mutex<T> {
582
582
/// Returns a mutable reference to the underlying data.
583
583
///
584
584
/// Since this call borrows the `Mutex` mutably, no actual locking needs to
585
- /// take place -- the mutable borrow statically guarantees no locks exist.
585
+ /// take place -- the mutable borrow statically guarantees no new locks can be acquired
586
+ /// while this reference exists. Note that this method does not clear any previous abandoned locks
587
+ /// (e.g., via [`forget()`] on a [`MutexGuard`]).
586
588
///
587
589
/// # Errors
588
590
///
@@ -599,6 +601,8 @@ impl<T: ?Sized> Mutex<T> {
599
601
/// *mutex.get_mut().unwrap() = 10;
600
602
/// assert_eq!(*mutex.lock().unwrap(), 10);
601
603
/// ```
604
+ ///
605
+ /// [`forget()`]: mem::forget
602
606
#[ stable( feature = "mutex_get_mut" , since = "1.6.0" ) ]
603
607
pub fn get_mut ( & mut self ) -> LockResult < & mut T > {
604
608
let data = self . data . get_mut ( ) ;
You can’t perform that action at this time.
0 commit comments