Skip to content

Commit 973c2f6

Browse files
committed
Explain that RefCell is single-threaded.
Fixes #21469.
1 parent 6869645 commit 973c2f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/cell.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
//! }
7575
//! ```
7676
//!
77+
//! Note that this example uses `Rc<T>` and not `Arc<T>`. `RefCell<T>`s are for single-threaded
78+
//! scenarios. Consider using `Mutex<T>` if you need shared mutability in a multi-threaded
79+
//! situation.
80+
//!
7781
//! ## Implementation details of logically-immutable methods
7882
//!
7983
//! Occasionally it may be desirable not to expose in an API that

0 commit comments

Comments
 (0)