diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 3f32abe1ea95..5b71d0b85a03 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -261,7 +261,6 @@ use core::convert::From; use alloc::{Global, Alloc, Layout, box_free, handle_alloc_error}; use string::String; -use sync::is_dangling; use vec::Vec; struct RcBox { @@ -1192,6 +1191,12 @@ impl Weak { } } +pub(crate) fn is_dangling(ptr: NonNull) -> bool { + let address = ptr.as_ptr() as *mut () as usize; + let align = align_of_val(unsafe { ptr.as_ref() }); + address == align +} + impl Weak { /// Attempts to upgrade the `Weak` pointer to an [`Rc`], extending /// the lifetime of the value if successful. diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index ea8616bf1d05..6710878b31d9 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -34,6 +34,7 @@ use core::convert::From; use alloc::{Global, Alloc, Layout, box_free, handle_alloc_error}; use boxed::Box; +use rc::is_dangling; use string::String; use vec::Vec; @@ -1038,12 +1039,6 @@ impl Weak { } } -pub(crate) fn is_dangling(ptr: NonNull) -> bool { - let address = ptr.as_ptr() as *mut () as usize; - let align = align_of_val(unsafe { ptr.as_ref() }); - address == align -} - impl Weak { /// Attempts to upgrade the `Weak` pointer to an [`Arc`], extending /// the lifetime of the value if successful.