fix ArenaPtr payload offset logic
the old logic would be incorrect if the payload has higher alignment than the ArenaHeader i.e. when there is padding between the ArenaHeader and the Payload
This commit is contained in:
@@ -283,7 +283,10 @@ pub trait ArenaAllocated {
|
||||
Self::Payload: Sized,
|
||||
{
|
||||
TypedArenaPtr(NonNull::new_unchecked(
|
||||
ptr.payload_offset().cast_mut().cast::<Self::Payload>(),
|
||||
ptr.get_ptr()
|
||||
.byte_add(Self::header_offset_from_payload())
|
||||
.cast_mut()
|
||||
.cast::<Self::Payload>(),
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user