diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2025-05-27 11:37:52 -0700 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-05-30 19:17:10 -0400 |
| commit | a1b94836aaada389a88062541b1ca431fd9fc9ee (patch) | |
| tree | bf220ddde2df5b760ec9797476805608b838411c | |
| parent | 9b35dee6ecabc8e92294c2072f66676fff8b1046 (diff) | |
[Rust] Make LowLevelIL{Expression,Instruction} implement Copy
| -rw-r--r-- | rust/src/low_level_il/expression.rs | 16 | ||||
| -rw-r--r-- | rust/src/low_level_il/function.rs | 4 | ||||
| -rw-r--r-- | rust/src/low_level_il/instruction.rs | 1 |
3 files changed, 19 insertions, 2 deletions
diff --git a/rust/src/low_level_il/expression.rs b/rust/src/low_level_il/expression.rs index 8df8dfe0..81c4e57d 100644 --- a/rust/src/low_level_il/expression.rs +++ b/rust/src/low_level_il/expression.rs @@ -59,6 +59,7 @@ where T: FnMut(&LowLevelILExpression<'func, M, F, ValueExpr>) -> VisitorAction; } +#[derive(Copy)] pub struct LowLevelILExpression<'func, M, F, R> where M: FunctionMutability, @@ -72,6 +73,21 @@ where pub(crate) _ty: PhantomData<R>, } +impl<M, F, R> Clone for LowLevelILExpression<'_, M, F, R> +where + M: FunctionMutability, + F: FunctionForm, + R: ExpressionResultType, +{ + fn clone(&self) -> Self { + Self { + function: self.function, + index: self.index, + _ty: PhantomData, + } + } +} + impl<'func, M, F, R> LowLevelILExpression<'func, M, F, R> where M: FunctionMutability, diff --git a/rust/src/low_level_il/function.rs b/rust/src/low_level_il/function.rs index 495aae79..d46350dc 100644 --- a/rust/src/low_level_il/function.rs +++ b/rust/src/low_level_il/function.rs @@ -31,7 +31,7 @@ pub struct Mutable; #[derive(Copy, Clone, Debug)] pub struct Finalized; -pub trait FunctionMutability: 'static + Debug {} +pub trait FunctionMutability: 'static + Debug + Copy {} impl FunctionMutability for Mutable {} impl FunctionMutability for Finalized {} @@ -40,7 +40,7 @@ pub struct SSA; #[derive(Copy, Clone, Debug)] pub struct NonSSA; -pub trait FunctionForm: 'static + Debug {} +pub trait FunctionForm: 'static + Debug + Copy {} impl FunctionForm for SSA {} impl FunctionForm for NonSSA {} diff --git a/rust/src/low_level_il/instruction.rs b/rust/src/low_level_il/instruction.rs index ef546412..df9d1839 100644 --- a/rust/src/low_level_il/instruction.rs +++ b/rust/src/low_level_il/instruction.rs @@ -65,6 +65,7 @@ where T: FnMut(&LowLevelILExpression<'func, M, F, ValueExpr>) -> VisitorAction; } +#[derive(Copy, Clone)] pub struct LowLevelILInstruction<'func, M, F> where M: FunctionMutability, |
