about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-10-08 13:38:59 +0800
committerGitHub <noreply@github.com>2017-10-08 13:38:59 +0800
commitc238df1ec346438869a1b6313cc3e34ee3814c4b (patch)
tree35a5fff6e8ad5958a9487a377c0de5c8f9783834 /src/liballoc
parent4090e81319380ee5963ed8a2d01759d3c4ff8644 (diff)
parent5e251b74eb200ba6d3b8ddaa68ef682c78be26e2 (diff)
downloadrust-c238df1ec346438869a1b6313cc3e34ee3814c4b.tar.gz
rust-c238df1ec346438869a1b6313cc3e34ee3814c4b.zip
Rollup merge of #45052 - steveklabnik:gh44105, r=dtolnay
Modify Rc/Arc language around mutability

There are a few exceptions to the rule that Arc/Rc are immutable. Rather
than dig into the details, add "generally" to hint at this difference,
as it's kind of a distraction at this point in the docs.

Additionally, Arc's docs were slightly different here generally, so add
in both the existing language and the exception.

Fixes #44105
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs6
-rw-r--r--src/liballoc/rc.rs2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 3b7dbd813cf..9481cd4e1a4 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -52,8 +52,10 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
 /// also destroyed.
 ///
 /// Shared references in Rust disallow mutation by default, and `Arc` is no
-/// exception. If you need to mutate through an `Arc`, use [`Mutex`][mutex],
-/// [`RwLock`][rwlock], or one of the [`Atomic`][atomic] types.
+/// exception: you cannot generally obtain a mutable reference to something
+/// inside an `Arc`. If you need to mutate through an `Arc`, use
+/// [`Mutex`][mutex], [`RwLock`][rwlock], or one of the [`Atomic`][atomic]
+/// types.
 ///
 /// ## Thread Safety
 ///
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 553980d463f..2f8620cc750 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -19,7 +19,7 @@
 //! given value is destroyed, the pointed-to value is also destroyed.
 //!
 //! Shared references in Rust disallow mutation by default, and [`Rc`]
-//! is no exception: you cannot obtain a mutable reference to
+//! is no exception: you cannot generally obtain a mutable reference to
 //! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
 //! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
 //! inside an Rc][mutability].