about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorFrank Steffahn <fdsteffahn@gmail.com>2021-08-24 21:15:26 +0200
committerFrank Steffahn <frank.steffahn@stu.uni-kiel.de>2021-08-24 21:17:20 +0200
commit335bf7ca6b2e63ffc5b7ee732819b7bf228a179e (patch)
treee5eb50a23a12282a9113f4b26fc9ea1042040772 /library/alloc/src
parent51d598ec285fc8aa29e2a1c64dc90394ccbd4130 (diff)
downloadrust-335bf7ca6b2e63ffc5b7ee732819b7bf228a179e.tar.gz
rust-335bf7ca6b2e63ffc5b7ee732819b7bf228a179e.zip
Clarifiy weak pointers being diassociated…
…noting the fact that `clone` is not called.

Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/rc.rs5
-rw-r--r--library/alloc/src/sync.rs5
2 files changed, 6 insertions, 4 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index 90b077210a4..272fc119f4e 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -1100,8 +1100,9 @@ impl<T: Clone> Rc<T> {
     /// [`clone`] the inner value to a new allocation to ensure unique ownership.  This is also
     /// referred to as clone-on-write.
     ///
-    /// If there are no other `Rc` pointers to this allocation, then [`Weak`]
-    /// pointers to this allocation will be disassociated.
+    /// However, if there are no other `Rc` pointers to this allocation, but some [`Weak`]
+    /// pointers, then the [`Weak`] pointers will be disassociated and the inner value will not
+    /// be cloned.
     ///
     /// See also [`get_mut`], which will fail rather than cloning.
     ///
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs
index 7e4cb6d2c60..2367eaec4b9 100644
--- a/library/alloc/src/sync.rs
+++ b/library/alloc/src/sync.rs
@@ -1350,8 +1350,9 @@ impl<T: Clone> Arc<T> {
     /// [`clone`] the inner value to a new allocation to ensure unique ownership.  This is also
     /// referred to as clone-on-write.
     ///
-    /// If there are no other `Arc` pointers to this allocation, then [`Weak`]
-    /// pointers to this allocation will be disassociated.
+    /// However, if there are no other `Arc` pointers to this allocation, but some [`Weak`]
+    /// pointers, then the [`Weak`] pointers will be disassociated and the inner value will not
+    /// be cloned.
     ///
     /// See also [`get_mut`], which will fail rather than cloning.
     ///