From 7cadf7bc0167d254d564ec81361db257e7ed2e82 Mon Sep 17 00:00:00 2001 From: Rupert Rutledge <1982481+Eosis@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:02:16 +0100 Subject: [PATCH] Alter std::cell::Cell::get_mut documentation I find this more consistent with RefCell's equivalent method. --- library/core/src/cell.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index f88a6e418c7c8..6fd4936158589 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -488,6 +488,13 @@ impl Cell { /// 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 /// /// ```