File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ pub enum AllocInit {
4747#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
4848#[ must_use = "`MemoryBlock` should be passed to `AllocRef::dealloc`" ]
4949pub struct MemoryBlock {
50- ptr : Unique < u8 > ,
50+ ptr : NonNull < u8 > ,
5151 layout : Layout ,
5252}
5353
@@ -63,15 +63,14 @@ impl MemoryBlock {
6363 #[ inline]
6464 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
6565 pub const unsafe fn new ( ptr : NonNull < u8 > , layout : Layout ) -> Self {
66- Self { ptr : Unique :: new_unchecked ( ptr . as_ptr ( ) ) , layout }
66+ Self { ptr, layout }
6767 }
6868
6969 /// Acquires the underlying `NonNull<u8>` pointer.
7070 #[ inline]
7171 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
7272 pub const fn ptr ( & self ) -> NonNull < u8 > {
73- // SAFETY: Unique<T> is always non-null
74- unsafe { NonNull :: new_unchecked ( self . ptr . as_ptr ( ) ) }
73+ self . ptr
7574 }
7675
7776 /// Returns the layout describing the memory block.
You can’t perform that action at this time.
0 commit comments