From 335bf7ca6b2e63ffc5b7ee732819b7bf228a179e Mon Sep 17 00:00:00 2001 From: Frank Steffahn Date: Tue, 24 Aug 2021 21:15:26 +0200 Subject: Clarifiy weak pointers being diassociated… MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …noting the fact that `clone` is not called. Co-authored-by: Mark Rousskov --- library/alloc/src/rc.rs | 5 +++-- library/alloc/src/sync.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'library/alloc/src') 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 Rc { /// [`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 Arc { /// [`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. /// -- cgit 1.4.1-3-g733a5