From 019c50d909bc86d4eb91bb8d652dcc39289c3250 Mon Sep 17 00:00:00 2001 From: Erik Simmler Date: Sat, 30 Nov 2024 20:33:52 -0500 Subject: [PATCH 1/2] Implement Eq manually to avoid unnecessarily requiring T: Eq --- canrun/src/core/value.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/canrun/src/core/value.rs b/canrun/src/core/value.rs index c50eeb0..7a7701b 100644 --- a/canrun/src/core/value.rs +++ b/canrun/src/core/value.rs @@ -23,12 +23,14 @@ debugging purposes as no guarantees are made about the type or generation of the id value. Also, these ids are only valid within the context of a single execution. They cannot be safely persisted or shared between processes. */ -#[derive(Debug, Copy, Eq)] +#[derive(Debug, Copy)] pub struct LVar { pub(crate) id: VarId, t: PhantomData, } +impl Eq for LVar {} + impl PartialEq for LVar { fn eq(&self, other: &LVar) -> bool { self.id == other.id @@ -212,3 +214,12 @@ impl Clone for Value { } } } + +#[cfg(test)] +mod test { + use crate::LVar; + + #[allow(dead_code)] + trait ImplsEq: Eq {} + impl ImplsEq for LVar {} +} From 635c30f3e17a36c08ea8c61a78ace91ece11cf6d Mon Sep 17 00:00:00 2001 From: Erik Simmler Date: Sat, 30 Nov 2024 20:35:39 -0500 Subject: [PATCH 2/2] Derive Clone for LVec --- canrun/src/collections/lvec/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canrun/src/collections/lvec/mod.rs b/canrun/src/collections/lvec/mod.rs index e26374f..bd67dc4 100644 --- a/canrun/src/collections/lvec/mod.rs +++ b/canrun/src/collections/lvec/mod.rs @@ -20,7 +20,7 @@ use std::rc::Rc; /// /// Construct with the [`lvec!`](crate::lvec!) macro, or you can use the /// `From>>` or `FromIterator>` trait implementations. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct LVec { vec: Vec>, }