This repository was archived by the owner on May 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +2
-6
lines changed Expand file tree Collapse file tree 3 files changed +2
-6
lines changed Original file line number Diff line number Diff line change 1
1
//! Reimplementation of the [atom] library with specialized and extended features.
2
2
//!
3
3
//! [atom]: https://crates.io/crates/atom
4
- #![ feature( box_into_raw_non_null) ]
5
4
#![ feature( const_fn) ] // `const fn` with a constrained type parameter (e.g., `T: PtrSized`)
6
5
use std:: cell:: Cell ;
7
6
use std:: marker:: PhantomData ;
@@ -85,7 +84,7 @@ impl<T: PtrSized> PtrSizedExt for T {
85
84
86
85
unsafe impl < T > PtrSized for Box < T > {
87
86
fn into_raw ( this : Self ) -> NonNull < ( ) > {
88
- unsafe { mem :: transmute ( Box :: into_raw_non_null ( this) ) }
87
+ NonNull :: from ( Box :: leak ( this) ) . cast ( )
89
88
}
90
89
unsafe fn from_raw ( ptr : NonNull < ( ) > ) -> Self {
91
90
Box :: from_raw ( ptr. as_ptr ( ) as _ )
Original file line number Diff line number Diff line change 1
1
//! Provides a customized version of `std::collections::LinkedList`.
2
- #![ feature( box_into_raw_non_null) ]
3
2
pub mod cell;
4
3
pub mod linked_list;
5
4
Original file line number Diff line number Diff line change @@ -177,9 +177,7 @@ impl<T: ?Sized> Node<T> {
177
177
fn box_into_hdr ( mut self : Box < Self > ) -> NonNull < Hdr > {
178
178
self . set_vtable ( ) ;
179
179
180
- let mut raw = Box :: into_raw_non_null ( self ) ;
181
-
182
- NonNull :: from ( unsafe { & mut raw. as_mut ( ) . hdr } )
180
+ NonNull :: from ( & mut Box :: leak ( self ) . hdr )
183
181
}
184
182
185
183
#[ inline]
You can’t perform that action at this time.
0 commit comments