File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 17
17
//! pointer to the same value in the heap. When the last [`Rc`] pointer to a
18
18
//! given value is destroyed, the pointed-to value is also destroyed.
19
19
//!
20
- //! Shared references in Rust disallow mutation by default, and `Rc` is no
21
- //! exception. If you need to mutate through an [`Rc`], use [`Cell`] or
22
- //! [`RefCell`].
20
+ //! Shared references in Rust disallow mutation by default, and [`Rc`]
21
+ //! is no exception: you cannot obtain a mutable reference to
22
+ //! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
23
+ //! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
24
+ //! inside an Rc][mutability].
23
25
//!
24
26
//! [`Rc`] uses non-atomic reference counting. This means that overhead is very
25
27
//! low, but an [`Rc`] cannot be sent between threads, and consequently [`Rc`]
214
216
//! [upgrade]: struct.Weak.html#method.upgrade
215
217
//! [`None`]: ../../std/option/enum.Option.html#variant.None
216
218
//! [assoc]: ../../book/method-syntax.html#associated-functions
219
+ //! [mutability]: ../../std/cell/index.html#introducing-mutability-inside-of-something-immutable
217
220
218
221
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
219
222
You can’t perform that action at this time.
0 commit comments