diff --git a/support/atom2/src/lib.rs b/support/atom2/src/lib.rs index e61423c4..2ae07bb6 100644 --- a/support/atom2/src/lib.rs +++ b/support/atom2/src/lib.rs @@ -1,7 +1,6 @@ //! Reimplementation of the [atom] library with specialized and extended features. //! //! [atom]: https://crates.io/crates/atom -#![feature(box_into_raw_non_null)] #![feature(const_fn)] // `const fn` with a constrained type parameter (e.g., `T: PtrSized`) use std::cell::Cell; use std::marker::PhantomData; @@ -85,7 +84,7 @@ impl PtrSizedExt for T { unsafe impl PtrSized for Box { fn into_raw(this: Self) -> NonNull<()> { - unsafe { mem::transmute(Box::into_raw_non_null(this)) } + NonNull::from(Box::leak(this)).cast() } unsafe fn from_raw(ptr: NonNull<()>) -> Self { Box::from_raw(ptr.as_ptr() as _) diff --git a/support/neo_linked_list/src/lib.rs b/support/neo_linked_list/src/lib.rs index 5bde8997..4c6bdcdf 100644 --- a/support/neo_linked_list/src/lib.rs +++ b/support/neo_linked_list/src/lib.rs @@ -1,5 +1,4 @@ //! Provides a customized version of `std::collections::LinkedList`. -#![feature(box_into_raw_non_null)] pub mod cell; pub mod linked_list; diff --git a/support/neo_linked_list/src/linked_list.rs b/support/neo_linked_list/src/linked_list.rs index 7e101c81..ffe527c4 100644 --- a/support/neo_linked_list/src/linked_list.rs +++ b/support/neo_linked_list/src/linked_list.rs @@ -177,9 +177,7 @@ impl Node { fn box_into_hdr(mut self: Box) -> NonNull { self.set_vtable(); - let mut raw = Box::into_raw_non_null(self); - - NonNull::from(unsafe { &mut raw.as_mut().hdr }) + NonNull::from(&mut Box::leak(self).hdr) } #[inline]