Skip to content

Commit 6c72394

Browse files
committed
liballoc/RawVec: constify non_null, restore ptr impl
1 parent 00f4d06 commit 6c72394

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/alloc/src/raw_vec.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,12 @@ impl<A: Allocator> RawVecInner<A> {
489489

490490
#[inline]
491491
const fn ptr<T>(&self) -> *mut T {
492-
self.ptr.as_ptr() as _
492+
self.non_null::<T>().as_ptr()
493493
}
494494

495495
#[inline]
496-
fn non_null<T>(&self) -> NonNull<T> {
497-
self.ptr.cast().into()
496+
const fn non_null<T>(&self) -> NonNull<T> {
497+
self.ptr.cast().as_non_null_ptr()
498498
}
499499

500500
#[inline]

0 commit comments

Comments
 (0)