diff options
| author | bors <bors@rust-lang.org> | 2017-02-02 21:58:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-02-02 21:58:10 +0000 |
| commit | eedaa94e330094a84f4df9aa52949515327f8e80 (patch) | |
| tree | 6aecbbce96b60f7526484eab622ad2817fc55dfc /src/liballoc | |
| parent | a47a6ea771ca4426b6bba29219bdc7d2bceec3d5 (diff) | |
| parent | d09e4de640de7632f82f034ef48f73e4ec0ea4ca (diff) | |
| download | rust-eedaa94e330094a84f4df9aa52949515327f8e80.tar.gz rust-eedaa94e330094a84f4df9aa52949515327f8e80.zip | |
Auto merge of #39470 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 9 pull requests - Successful merges: #38823, #39196, #39299, #39319, #39373, #39383, #39416, #39420, #39427 - Failed merges:
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 010e378ef2f..6108a06634b 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -17,9 +17,11 @@ //! pointer to the same value in the heap. When the last [`Rc`] pointer to a //! given value is destroyed, the pointed-to value is also destroyed. //! -//! Shared references in Rust disallow mutation by default, and `Rc` is no -//! exception. If you need to mutate through an [`Rc`], use [`Cell`] or -//! [`RefCell`]. +//! Shared references in Rust disallow mutation by default, and [`Rc`] +//! is no exception: you cannot 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]. //! //! [`Rc`] uses non-atomic reference counting. This means that overhead is very //! low, but an [`Rc`] cannot be sent between threads, and consequently [`Rc`] @@ -214,6 +216,7 @@ //! [upgrade]: struct.Weak.html#method.upgrade //! [`None`]: ../../std/option/enum.Option.html#variant.None //! [assoc]: ../../book/method-syntax.html#associated-functions +//! [mutability]: ../../std/cell/index.html#introducing-mutability-inside-of-something-immutable #![stable(feature = "rust1", since = "1.0.0")] |
