Fix is_dangling import when Arc is #[cfg]’ed out
This commit is contained in:
parent
5717d99d1b
commit
67202b8b68
2 changed files with 7 additions and 7 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue