File tree 1 file changed +9
-9
lines changed
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> {
1509
1509
pub fn new ( ) -> Weak < T > {
1510
1510
Weak { ptr : NonNull :: new ( usize:: MAX as * mut ArcInner < T > ) . expect ( "MAX is not 0" ) }
1511
1511
}
1512
+ }
1512
1513
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 > {
1513
1522
/// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
1514
1523
///
1515
1524
/// The pointer is valid only if there are some strong references. The pointer may be dangling,
@@ -1642,16 +1651,7 @@ impl<T> Weak<T> {
1642
1651
// SAFETY: we now have recovered the original Weak pointer, so can create the Weak.
1643
1652
unsafe { Weak { ptr : NonNull :: new_unchecked ( ptr) } }
1644
1653
}
1645
- }
1646
1654
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 > {
1655
1655
/// Attempts to upgrade the `Weak` pointer to an [`Arc`], delaying
1656
1656
/// dropping of the inner value if successful.
1657
1657
///
You can’t perform that action at this time.
0 commit comments