diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2018-07-07 01:44:57 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-07-07 01:44:57 +0200 |
| commit | 67202b8b68d93c90e89ca001945865f13bc97154 (patch) | |
| tree | a8794d3b4071cd0b9013df73f05d0195f7af7640 /src/liballoc/sync.rs | |
| parent | 5717d99d1b3b76ec7814c95dfcc0399ab4ddaa83 (diff) | |
| download | rust-67202b8b68d93c90e89ca001945865f13bc97154.tar.gz rust-67202b8b68d93c90e89ca001945865f13bc97154.zip | |
Fix is_dangling import when Arc is #[cfg]’ed out
Diffstat (limited to 'src/liballoc/sync.rs')
| -rw-r--r-- | src/liballoc/sync.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index ea8616bf1d0..6710878b31d 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<T> Weak<T> { } } -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. |
