about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-01-21 12:43:34 -0500
committerSteve Klabnik <steve@steveklabnik.com>2015-01-21 12:43:34 -0500
commit973c2f65ae1efab1d6b7446f57311f66bec85375 (patch)
treefd920e0a1d0d55534a38c622f35c72eb65756b7d
parent6869645e86c91544b8737b89809bdf10bef536d9 (diff)
downloadrust-973c2f65ae1efab1d6b7446f57311f66bec85375.tar.gz
rust-973c2f65ae1efab1d6b7446f57311f66bec85375.zip
Explain that RefCell is single-threaded.
Fixes #21469.
-rw-r--r--src/libcore/cell.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 963cb48db07..7f73be9eb5f 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -74,6 +74,10 @@
 //! }
 //! ```
 //!
+//! Note that this example uses `Rc<T>` and not `Arc<T>`. `RefCell<T>`s are for single-threaded
+//! scenarios. Consider using `Mutex<T>` if you need shared mutability in a multi-threaded
+//! situation.
+//!
 //! ## Implementation details of logically-immutable methods
 //!
 //! Occasionally it may be desirable not to expose in an API that