From f580872fe2d7078d8a40671a641043a0939a3c6a Mon Sep 17 00:00:00 2001 From: Sergey Ivanov Date: Fri, 17 Apr 2026 07:47:34 +0000 Subject: [PATCH] Extended the documentation for Arc's Weak::upgrade --- library/alloc/src/rc.rs | 8 +++++++- library/alloc/src/sync.rs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index af76fddaced7..8d79de80695e 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -3501,7 +3501,13 @@ pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self { /// Attempts to upgrade the `Weak` pointer to an [`Rc`], delaying /// dropping of the inner value if successful. /// - /// Returns [`None`] if the inner value has since been dropped. + /// Returns [`None`] in the following cases: + /// + /// 1. The inner value has since been dropped or moved out. + /// + /// 2. This `Weak` does not point to an allocation. + /// + /// 3. The owning reference this `Weak` is associated with is either not fully-constructed or does not allow an upgrade. /// /// # Examples /// diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index af1eaf2015e9..fe54cf62f611 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -3232,7 +3232,13 @@ impl Weak { /// Attempts to upgrade the `Weak` pointer to an [`Arc`], delaying /// dropping of the inner value if successful. /// - /// Returns [`None`] if the inner value has since been dropped. + /// Returns [`None`] in the following cases: + /// + /// 1. The inner value has since been dropped or moved out. + /// + /// 2. This `Weak` does not point to an allocation. + /// + /// 3. The owning reference this `Weak` is associated with is either not fully-constructed or does not allow an upgrade. /// /// # Examples ///