From 74720d4d2ef07cf6848cd44470ee713c97938a5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bennet=20Ble=C3=9Fmann?= Date: Sun, 7 Jul 2024 14:18:50 +0200 Subject: [PATCH] remove unsafe `impl From for CodeIndex` --- src/machine/heap.rs | 4 ++-- src/machine/machine_indices.rs | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) 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 { -- 2.54.0