diff --git a/interp/Cargo.toml b/interp/Cargo.toml index 9a84606a0..8d99d1a84 100644 --- a/interp/Cargo.toml +++ b/interp/Cargo.toml @@ -48,8 +48,6 @@ baa = { version = "0.14.0", features = ["bigint", "serde1", "fraction1"] } fst-writer = "0.2.1" bon = "2.3" -# derivative = "2.2.0" - [dev-dependencies] proptest = "1.0.0" diff --git a/interp/src/flatten/primitives/prim_trait.rs b/interp/src/flatten/primitives/prim_trait.rs index e6c90fb4f..199adce45 100644 --- a/interp/src/flatten/primitives/prim_trait.rs +++ b/interp/src/flatten/primitives/prim_trait.rs @@ -161,7 +161,7 @@ pub trait RaceDetectionPrimitive: Primitive { /// optional default implementation due to size rules fn as_primitive(&self) -> &dyn Primitive; - fn clone_boxed(&self) -> Box; + fn clone_boxed_rd(&self) -> Box; } /// An empty primitive implementation used for testing. It does not do anything diff --git a/interp/src/flatten/primitives/stateful/memories.rs b/interp/src/flatten/primitives/stateful/memories.rs index adb8aa609..8365907f2 100644 --- a/interp/src/flatten/primitives/stateful/memories.rs +++ b/interp/src/flatten/primitives/stateful/memories.rs @@ -144,7 +144,7 @@ impl Primitive for StdReg { } impl RaceDetectionPrimitive for StdReg { - fn clone_boxed(&self) -> Box { + fn clone_boxed_rd(&self) -> Box { Box::new(self.clone()) } @@ -624,7 +624,7 @@ impl Primitive for CombMem { } impl RaceDetectionPrimitive for CombMem { - fn clone_boxed(&self) -> Box { + fn clone_boxed_rd(&self) -> Box { Box::new(self.clone()) } @@ -939,7 +939,7 @@ impl Primitive for SeqMem { } impl RaceDetectionPrimitive for SeqMem { - fn clone_boxed(&self) -> Box { + fn clone_boxed_rd(&self) -> Box { Box::new(self.clone()) } diff --git a/interp/src/flatten/structures/environment/env.rs b/interp/src/flatten/structures/environment/env.rs index 606e9f735..65769f4d1 100644 --- a/interp/src/flatten/structures/environment/env.rs +++ b/interp/src/flatten/structures/environment/env.rs @@ -49,8 +49,8 @@ use itertools::Itertools; use owo_colors::OwoColorize; use slog::{info, warn, Logger}; +use std::fmt::Debug; use std::fmt::Write; -use std::{fmt::Debug, ops::Deref}; pub type PortMap = IndexedMap; @@ -201,9 +201,7 @@ impl Clone for CellLedger { }, Self::RaceDetectionPrimitive { cell_dyn } => { Self::RaceDetectionPrimitive { - cell_dyn: RaceDetectionPrimitive::clone_boxed( - cell_dyn.deref(), - ), + cell_dyn: cell_dyn.clone_boxed_rd(), } } Self::Component(component_ledger) => { diff --git a/interp/src/flatten/structures/indexed_map.rs b/interp/src/flatten/structures/indexed_map.rs index e2dce880d..e3f24c315 100644 --- a/interp/src/flatten/structures/indexed_map.rs +++ b/interp/src/flatten/structures/indexed_map.rs @@ -4,7 +4,7 @@ use std::{ ops::{self, Index}, }; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct IndexedMap where K: IndexRef, @@ -144,19 +144,6 @@ where } } -impl Clone for IndexedMap -where - K: IndexRef, - T: Clone, -{ - fn clone(&self) -> Self { - Self { - data: self.data.clone(), - phantom: PhantomData, - } - } -} - #[allow(dead_code)] pub struct IndexedMapRangeIterator<'range, 'data, K, D> where