Skip to content

Commit

Permalink
Clarifiy weak pointers being diassociated…
Browse files Browse the repository at this point in the history
…noting the fact that `clone` is not called.

Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
  • Loading branch information
steffahn and Mark-Simulacrum committed Aug 24, 2021
1 parent 51d598e commit 335bf7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions library/alloc/src/rc.rs
Expand Up @@ -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.
///
Expand Down
5 changes: 3 additions & 2 deletions library/alloc/src/sync.rs
Expand Up @@ -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.
///
Expand Down

0 comments on commit 335bf7c

Please sign in to comment.