allocate negator results in arena (#1898)

This commit is contained in:
Mark
2023-08-02 19:50:27 -06:00
parent 2c05ebbded
commit ec450fc567
2 changed files with 15 additions and 11 deletions

View File

@@ -242,9 +242,11 @@ impl<T: fmt::Display> fmt::Display for TypedArenaPtr<T> {
}
impl<T: ?Sized + ArenaAllocated> TypedArenaPtr<T> {
// data must be allocated in the arena already.
#[inline]
pub const fn new(data: *mut T) -> Self {
unsafe { TypedArenaPtr(ptr::NonNull::new_unchecked(data)) }
let result = unsafe { TypedArenaPtr(ptr::NonNull::new_unchecked(data)) };
result
}
#[inline]