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 {
47
47
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
48
48
#[ must_use = "`MemoryBlock` should be passed to `AllocRef::dealloc`" ]
49
49
pub struct MemoryBlock {
50
- ptr : Unique < u8 > ,
50
+ ptr : NonNull < u8 > ,
51
51
layout : Layout ,
52
52
}
53
53
@@ -63,15 +63,14 @@ impl MemoryBlock {
63
63
#[ inline]
64
64
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
65
65
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 }
67
67
}
68
68
69
69
/// Acquires the underlying `NonNull<u8>` pointer.
70
70
#[ inline]
71
71
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
72
72
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
75
74
}
76
75
77
76
/// Returns the layout describing the memory block.
You can’t perform that action at this time.
0 commit comments