File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -1509,7 +1509,16 @@ impl<T> Weak<T> {
15091509 pub fn new ( ) -> Weak < T > {
15101510 Weak { ptr : NonNull :: new ( usize:: MAX as * mut ArcInner < T > ) . expect ( "MAX is not 0" ) }
15111511 }
1512+ }
15121513
1514+ /// Helper type to allow accessing the reference counts without
1515+ /// making any assertions about the data field.
1516+ struct WeakInner < ' a > {
1517+ weak : & ' a atomic:: AtomicUsize ,
1518+ strong : & ' a atomic:: AtomicUsize ,
1519+ }
1520+
1521+ impl < T : ?Sized > Weak < T > {
15131522 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
15141523 ///
15151524 /// The pointer is valid only if there are some strong references. The pointer may be dangling,
@@ -1642,16 +1651,7 @@ impl<T> Weak<T> {
16421651 // SAFETY: we now have recovered the original Weak pointer, so can create the Weak.
16431652 unsafe { Weak { ptr : NonNull :: new_unchecked ( ptr) } }
16441653 }
1645- }
16461654
1647- /// Helper type to allow accessing the reference counts without
1648- /// making any assertions about the data field.
1649- struct WeakInner < ' a > {
1650- weak : & ' a atomic:: AtomicUsize ,
1651- strong : & ' a atomic:: AtomicUsize ,
1652- }
1653-
1654- impl < T : ?Sized > Weak < T > {
16551655 /// Attempts to upgrade the `Weak` pointer to an [`Arc`], delaying
16561656 /// dropping of the inner value if successful.
16571657 ///
You can’t perform that action at this time.
0 commit comments