From: Bennet Bleßmann Date: Sun, 7 Jul 2024 12:18:50 +0000 (+0200) Subject: remove unsafe `impl From for CodeIndex` X-Git-Tag: v0.10.0~127^2~5 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=74720d4d2ef07cf6848cd44470ee713c97938a5f;p=scryer-prolog.git remove unsafe `impl From for CodeIndex` --- diff --git a/src/machine/heap.rs b/src/machine/heap.rs index 7ba02da9..0f42b8c6 100644 --- a/src/machine/heap.rs +++ b/src/machine/heap.rs @@ -69,8 +69,8 @@ impl TryFrom for Literal { (ArenaHeaderTag::Rational, n) => { Ok(Literal::Rational(n)) } - (ArenaHeaderTag::IndexPtr, _ip) => { - Ok(Literal::CodeIndex(CodeIndex::from(cons_ptr))) + (ArenaHeaderTag::IndexPtr, ip) => { + Ok(Literal::CodeIndex(CodeIndex::from(ip))) } _ => { Err(()) diff --git a/src/machine/machine_indices.rs b/src/machine/machine_indices.rs index cecdef22..9dc8138e 100644 --- a/src/machine/machine_indices.rs +++ b/src/machine/machine_indices.rs @@ -159,13 +159,6 @@ impl From for UntypedArenaPtr { } } -impl From for CodeIndex { - #[inline(always)] - fn from(ptr: UntypedArenaPtr) -> CodeIndex { - CodeIndex(unsafe { ptr.as_typed_ptr() }) - } -} - impl From> for CodeIndex { #[inline(always)] fn from(ptr: TypedArenaPtr) -> CodeIndex {