Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 72dbbee

Browse files
committed
Remove confusing 'mutability root' term
And some other outdated language. @echochamber came asking about these docs on IRC today, and they're a bit weird. I've updated them to be less ambiguous and use contemporary terminology.
1 parent b5dad7d commit 72dbbee

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/libcore/cell.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
//! would otherwise be disallowed though, there are occasions when interior mutability might be
3737
//! appropriate, or even *must* be used, e.g.
3838
//!
39-
//! * Introducing inherited mutability roots to shared types.
39+
//! * Introducing mutability 'inside' of something immutable
4040
//! * Implementation details of logically-immutable methods.
4141
//! * Mutating implementations of `Clone`.
4242
//!
43-
//! ## Introducing inherited mutability roots to shared types
43+
//! ## Introducing mutability 'inside' of something immutable
4444
//!
45-
//! Shared smart pointer types, including `Rc<T>` and `Arc<T>`, provide containers that can be
45+
//! Many shared smart pointer types, including `Rc<T>` and `Arc<T>`, provide containers that can be
4646
//! cloned and shared between multiple parties. Because the contained values may be
47-
//! multiply-aliased, they can only be borrowed as shared references, not mutable references.
48-
//! Without cells it would be impossible to mutate data inside of shared boxes at all!
47+
//! multiply-aliased, they can only be borrowed with `&`, not `&mut`. Without cells it would be
48+
//! impossible to mutate data inside of these smart pointers at all.
4949
//!
5050
//! It's very common then to put a `RefCell<T>` inside shared pointer types to reintroduce
5151
//! mutability:
@@ -65,8 +65,8 @@
6565
//! ```
6666
//!
6767
//! Note that this example uses `Rc<T>` and not `Arc<T>`. `RefCell<T>`s are for single-threaded
68-
//! scenarios. Consider using `Mutex<T>` if you need shared mutability in a multi-threaded
69-
//! situation.
68+
//! scenarios. Consider using `RwLock<T>` or `Mutex<T>` if you need shared mutability in a
69+
//! multi-threaded situation.
7070
//!
7171
//! ## Implementation details of logically-immutable methods
7272
//!

0 commit comments

Comments
 (0)