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:
Bennet Bleßmann
2024-07-05 23:45:02 +02:00
parent a93585080c
commit dd2548453b
5 changed files with 102 additions and 116 deletions

View File

@@ -160,7 +160,7 @@ impl From<CodeIndex> for UntypedArenaPtr {
impl From<UntypedArenaPtr> for CodeIndex {
#[inline(always)]
fn from(ptr: UntypedArenaPtr) -> CodeIndex {
CodeIndex(TypedArenaPtr::new(ptr.get_ptr() as *mut IndexPtr))
CodeIndex(unsafe { ptr.as_typed_ptr() })
}
}