about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRupert Rutledge <1982481+Eosis@users.noreply.github.com>2021-06-17 11:02:16 +0100
committerRupert Rutledge <1982481+Eosis@users.noreply.github.com>2021-06-17 11:02:16 +0100
commit7cadf7bc0167d254d564ec81361db257e7ed2e82 (patch)
tree7b4aa37745b7fcaebc5f8835159610c7e3ddb88a
parentcb3c4ee7187b045683cb9b86135dbbb766471091 (diff)
downloadrust-7cadf7bc0167d254d564ec81361db257e7ed2e82.tar.gz
rust-7cadf7bc0167d254d564ec81361db257e7ed2e82.zip
Alter std::cell::Cell::get_mut documentation
I find this more consistent with RefCell's equivalent method.
-rw-r--r--library/core/src/cell.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs
index f88a6e418c7..6fd49361585 100644
--- a/library/core/src/cell.rs
+++ b/library/core/src/cell.rs
@@ -488,6 +488,13 @@ impl<T: ?Sized> Cell<T> {
     /// This call borrows `Cell` mutably (at compile-time) which guarantees
     /// that we possess the only reference.
     ///
+    /// However be cautious: this method expects `self` to be mutable, which is
+    /// generally not the case when using a `Cell`. If you require interior
+    /// mutability by reference, consider using `RefCell` which provides
+    /// run-time checked mutable borrows through its [`borrow_mut`] method.
+    ///
+    /// [`borrow_mut`]: RefCell::borrow_mut()
+    ///
     /// # Examples
     ///
     /// ```