From: Mark Thom Date: Tue, 11 Jan 2022 01:25:30 +0000 (-0700) Subject: imitate Rc-style equality for TypedArenaPtr (#1190) X-Git-Tag: v0.9.0^2~81 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=f0e6b8ca47ed1243746134aa7d71208dd823424e;p=scryer-prolog.git imitate Rc-style equality for TypedArenaPtr (#1190) --- diff --git a/src/arena.rs b/src/arena.rs index d0244fae..0dde0751 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -72,9 +72,17 @@ impl ArenaHeader { } } -#[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] +#[derive(Debug, PartialOrd, Ord)] pub struct TypedArenaPtr(ptr::NonNull); +impl PartialEq for TypedArenaPtr { + fn eq(&self, other: &TypedArenaPtr) -> bool { + self.0 == other.0 || &**self == &**other + } +} + +impl Eq for TypedArenaPtr {} + impl Hash for TypedArenaPtr { #[inline(always)] fn hash(&self, hasher: &mut H) {