File tree Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -1156,7 +1156,9 @@ impl<T: ?Sized> RefCell<T> {
11561156 /// Since this method borrows `RefCell` mutably, it is statically guaranteed
11571157 /// that no borrows to the underlying data exist. The dynamic checks inherent
11581158 /// in [`borrow_mut`] and most other methods of `RefCell` are therefore
1159- /// unnecessary.
1159+ /// unnecessary. Note that this method does not reset the borrowing state if borrows were previously leaked
1160+ /// (e.g., via [`forget()`] on a [`Ref`] or [`RefMut`]). For that purpose,
1161+ /// consider using the unstable [`undo_leak`] method.
11601162 ///
11611163 /// This method can only be called if `RefCell` can be mutably borrowed,
11621164 /// which in general is only the case directly after the `RefCell` has
@@ -1167,6 +1169,8 @@ impl<T: ?Sized> RefCell<T> {
11671169 /// Use [`borrow_mut`] to get mutable access to the underlying data then.
11681170 ///
11691171 /// [`borrow_mut`]: RefCell::borrow_mut()
1172+ /// [`forget()`]: mem::forget
1173+ /// [`undo_leak`]: RefCell::undo_leak()
11701174 ///
11711175 /// # Examples
11721176 ///
Original file line number Diff line number Diff line change @@ -427,7 +427,7 @@ pub unsafe trait CloneToUninit {
427427 /// read or dropped, because even if it was previously valid, it may have been partially
428428 /// overwritten.
429429 ///
430- /// The caller may wish to to take care to deallocate the allocation pointed to by `dest`,
430+ /// The caller may wish to take care to deallocate the allocation pointed to by `dest`,
431431 /// if applicable, to avoid a memory leak (but this is not a requirement).
432432 ///
433433 /// Implementors should avoid leaking values by, upon unwinding, dropping all component values
Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ macro_rules! i8_xe_bytes_doc {
9999
100100**Note**: This function is meaningless on `i8`. Byte order does not exist as a
101101concept for byte-sized integers. This function is only provided in symmetry
102- with larger integer types. You can cast from and to `u8` using `as i8` and `as
103- u8` .
102+ with larger integer types. You can cast from and to `u8` using
103+ [`cast_signed`](u8::cast_signed) and [`cast_unsigned`](Self::cast_unsigned) .
104104
105105"
106106 } ;
Original file line number Diff line number Diff line change @@ -582,7 +582,9 @@ impl<T: ?Sized> Mutex<T> {
582582 /// Returns a mutable reference to the underlying data.
583583 ///
584584 /// 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`]).
586588 ///
587589 /// # Errors
588590 ///
@@ -599,6 +601,8 @@ impl<T: ?Sized> Mutex<T> {
599601 /// *mutex.get_mut().unwrap() = 10;
600602 /// assert_eq!(*mutex.lock().unwrap(), 10);
601603 /// ```
604+ ///
605+ /// [`forget()`]: mem::forget
602606 #[ stable( feature = "mutex_get_mut" , since = "1.6.0" ) ]
603607 pub fn get_mut ( & mut self ) -> LockResult < & mut T > {
604608 let data = self . data . get_mut ( ) ;
Original file line number Diff line number Diff line change @@ -608,7 +608,9 @@ impl<T: ?Sized> RwLock<T> {
608608 /// Returns a mutable reference to the underlying data.
609609 ///
610610 /// Since this call borrows the `RwLock` mutably, no actual locking needs to
611- /// take place -- the mutable borrow statically guarantees no locks exist.
611+ /// take place -- the mutable borrow statically guarantees no new locks can be acquired
612+ /// while this reference exists. Note that this method does not clear any previously abandoned locks
613+ /// (e.g., via [`forget()`] on a [`RwLockReadGuard`] or [`RwLockWriteGuard`]).
612614 ///
613615 /// # Errors
614616 ///
You can’t perform that action at this time.
0 commit comments