Skip to content

Commit f580872

Browse files
committed
Extended the documentation for Arc's Weak::upgrade
1 parent 4c42051 commit f580872

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

library/alloc/src/rc.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3501,7 +3501,13 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
35013501
/// Attempts to upgrade the `Weak` pointer to an [`Rc`], delaying
35023502
/// dropping of the inner value if successful.
35033503
///
3504-
/// Returns [`None`] if the inner value has since been dropped.
3504+
/// Returns [`None`] in the following cases:
3505+
///
3506+
/// 1. The inner value has since been dropped or moved out.
3507+
///
3508+
/// 2. This `Weak` does not point to an allocation.
3509+
///
3510+
/// 3. The owning reference this `Weak` is associated with is either not fully-constructed or does not allow an upgrade.
35053511
///
35063512
/// # Examples
35073513
///

library/alloc/src/sync.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,13 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
32323232
/// Attempts to upgrade the `Weak` pointer to an [`Arc`], delaying
32333233
/// dropping of the inner value if successful.
32343234
///
3235-
/// Returns [`None`] if the inner value has since been dropped.
3235+
/// Returns [`None`] in the following cases:
3236+
///
3237+
/// 1. The inner value has since been dropped or moved out.
3238+
///
3239+
/// 2. This `Weak` does not point to an allocation.
3240+
///
3241+
/// 3. The owning reference this `Weak` is associated with is either not fully-constructed or does not allow an upgrade.
32363242
///
32373243
/// # Examples
32383244
///

0 commit comments

Comments
 (0)