diff --git a/src/arena.rs b/src/arena.rs index 1b5cd3e5..ffb92fb7 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -283,7 +283,10 @@ pub trait ArenaAllocated { Self::Payload: Sized, { TypedArenaPtr(NonNull::new_unchecked( - ptr.payload_offset().cast_mut().cast::(), + ptr.get_ptr() + .byte_add(Self::header_offset_from_payload()) + .cast_mut() + .cast::(), )) } diff --git a/src/types.rs b/src/types.rs index 994a6a27..bcf67a4a 100644 --- a/src/types.rs +++ b/src/types.rs @@ -754,11 +754,6 @@ impl UntypedArenaPtr { } } - #[inline] - pub fn payload_offset(self) -> *const u8 { - unsafe { self.get_ptr().byte_add(size_of::()).cast() } - } - /// # Safety /// - this UntypedArenaPtr actual pointee type is T /// - the pointer must be non-null