1
Fork 0

Rc: remove unused allocation from Weak::new()

Same as https://github.com/rust-lang/rust/pull/50357
This commit is contained in:
Simon Sapin 2018-06-27 18:09:21 +02:00
parent 6e2c49ff0e
commit 41730b7e2e
2 changed files with 37 additions and 24 deletions

View file

@ -1038,7 +1038,7 @@ impl<T> Weak<T> {
}
}
fn is_dangling<T: ?Sized>(ptr: NonNull<T>) -> bool {
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