From 973c2f65ae1efab1d6b7446f57311f66bec85375 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 21 Jan 2015 12:43:34 -0500 Subject: [PATCH] Explain that RefCell is single-threaded. Fixes #21469. --- src/libcore/cell.rs | 4 ++++ 1 file changed, 4 insertions(+) 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` and not `Arc`. `RefCell`s are for single-threaded +//! scenarios. Consider using `Mutex` 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