rework some unsafe parts
- removed some unsafe - added some safety comments - add explicit types to transmute calls - reworked UntypedArenaPtr -> TypedArenaPtr conversion might help with mthom/scryer-prolog#2438, I noticed fewer complains from miri after changing the default impl for `ArenaAllocated::alloc`
This commit is contained in:
@@ -743,6 +743,13 @@ impl UntypedArenaPtr {
|
||||
unsafe { self.get_ptr().add(mem::size_of::<ArenaHeader>()) }
|
||||
}
|
||||
|
||||
/// Safety
|
||||
/// - this UntypedArenaPtr actuall pointee type is T
|
||||
#[inline]
|
||||
pub unsafe fn as_typed_ptr<T: ArenaAllocated>(self) -> TypedArenaPtr<T> {
|
||||
T::typed_ptr(self)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_mark_bit(self) -> bool {
|
||||
self.m()
|
||||
|
||||
Reference in New Issue
Block a user