From 67202b8b68d93c90e89ca001945865f13bc97154 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 7 Jul 2018 01:44:57 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20is=5Fdangling=20import=20when=20Arc=20is?= =?UTF-8?q?=20#[cfg]=E2=80=99ed=20out?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/liballoc/rc.rs | 7 ++++++- src/liballoc/sync.rs | 7 +------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 3f32abe1ea959..5b71d0b85a03e 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 ea8616bf1d05c..6710878b31d94 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.