Skip to content

Commit 335bf7c

Browse files
Clarifiy weak pointers being diassociated…
…noting the fact that `clone` is not called. Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
1 parent 51d598e commit 335bf7c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

library/alloc/src/rc.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,9 @@ impl<T: Clone> Rc<T> {
11001100
/// [`clone`] the inner value to a new allocation to ensure unique ownership. This is also
11011101
/// referred to as clone-on-write.
11021102
///
1103-
/// If there are no other `Rc` pointers to this allocation, then [`Weak`]
1104-
/// pointers to this allocation will be disassociated.
1103+
/// However, if there are no other `Rc` pointers to this allocation, but some [`Weak`]
1104+
/// pointers, then the [`Weak`] pointers will be disassociated and the inner value will not
1105+
/// be cloned.
11051106
///
11061107
/// See also [`get_mut`], which will fail rather than cloning.
11071108
///

library/alloc/src/sync.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1350,8 +1350,9 @@ impl<T: Clone> Arc<T> {
13501350
/// [`clone`] the inner value to a new allocation to ensure unique ownership. This is also
13511351
/// referred to as clone-on-write.
13521352
///
1353-
/// If there are no other `Arc` pointers to this allocation, then [`Weak`]
1354-
/// pointers to this allocation will be disassociated.
1353+
/// However, if there are no other `Arc` pointers to this allocation, but some [`Weak`]
1354+
/// pointers, then the [`Weak`] pointers will be disassociated and the inner value will not
1355+
/// be cloned.
13551356
///
13561357
/// See also [`get_mut`], which will fail rather than cloning.
13571358
///

0 commit comments

Comments
 (0)