Skip to content

Commit 7cadf7b

Browse files
committed
Alter std::cell::Cell::get_mut documentation
I find this more consistent with RefCell's equivalent method.
1 parent cb3c4ee commit 7cadf7b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/core/src/cell.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,13 @@ impl<T: ?Sized> Cell<T> {
488488
/// This call borrows `Cell` mutably (at compile-time) which guarantees
489489
/// that we possess the only reference.
490490
///
491+
/// However be cautious: this method expects `self` to be mutable, which is
492+
/// generally not the case when using a `Cell`. If you require interior
493+
/// mutability by reference, consider using `RefCell` which provides
494+
/// run-time checked mutable borrows through its [`borrow_mut`] method.
495+
///
496+
/// [`borrow_mut`]: RefCell::borrow_mut()
497+
///
491498
/// # Examples
492499
///
493500
/// ```

0 commit comments

Comments
 (0)