File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1675,7 +1675,14 @@ impl<T> Weak<T> {
1675
1675
pub fn new ( ) -> Weak < T > {
1676
1676
Weak { ptr : NonNull :: new ( usize:: MAX as * mut RcBox < T > ) . expect ( "MAX is not 0" ) }
1677
1677
}
1678
+ }
1678
1679
1680
+ pub ( crate ) fn is_dangling < T : ?Sized > ( ptr : NonNull < T > ) -> bool {
1681
+ let address = ptr. as_ptr ( ) as * mut ( ) as usize ;
1682
+ address == usize:: MAX
1683
+ }
1684
+
1685
+ impl < T : ?Sized > Weak < T > {
1679
1686
/// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
1680
1687
///
1681
1688
/// The pointer is valid only if there are some strong references. The pointer may be dangling,
@@ -1808,14 +1815,7 @@ impl<T> Weak<T> {
1808
1815
}
1809
1816
}
1810
1817
}
1811
- }
1812
1818
1813
- pub ( crate ) fn is_dangling < T : ?Sized > ( ptr : NonNull < T > ) -> bool {
1814
- let address = ptr. as_ptr ( ) as * mut ( ) as usize ;
1815
- address == usize:: MAX
1816
- }
1817
-
1818
- impl < T : ?Sized > Weak < T > {
1819
1819
/// Attempts to upgrade the `Weak` pointer to an [`Rc`], delaying
1820
1820
/// dropping of the inner value if successful.
1821
1821
///
You can’t perform that action at this time.
0 commit comments