use alloc::{Global, Alloc, Layout, box_free, handle_alloc_error};
use string::String;
-use sync::is_dangling;
use vec::Vec;
struct RcBox<T: ?Sized> {
}
}
+pub(crate) fn is_dangling<T: ?Sized>(ptr: NonNull<T>) -> bool {
+ let address = ptr.as_ptr() as *mut () as usize;
+ let align = align_of_val(unsafe { ptr.as_ref() });
+ address == align
+}
+
impl<T: ?Sized> Weak<T> {
/// Attempts to upgrade the `Weak` pointer to an [`Rc`], extending
/// the lifetime of the value if successful.
use alloc::{Global, Alloc, Layout, box_free, handle_alloc_error};
use boxed::Box;
+use rc::is_dangling;
use string::String;
use vec::Vec;
}
}
-pub(crate) fn is_dangling<T: ?Sized>(ptr: NonNull<T>) -> bool {
- let address = ptr.as_ptr() as *mut () as usize;
- let align = align_of_val(unsafe { ptr.as_ref() });
- address == align
-}
-
impl<T: ?Sized> Weak<T> {
/// Attempts to upgrade the `Weak` pointer to an [`Arc`], extending
/// the lifetime of the value if successful.