Skip to content

Commit 416e0e6

Browse files
committed
[Rust] Make LowLevelIL{Expression,Instruction} implement Copy
1 parent 1431470 commit 416e0e6

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

rust/src/low_level_il/expression.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ where
5959
T: FnMut(&LowLevelILExpression<'func, M, F, ValueExpr>) -> VisitorAction;
6060
}
6161

62+
#[derive(Copy)]
6263
pub struct LowLevelILExpression<'func, M, F, R>
6364
where
6465
M: FunctionMutability,
@@ -72,6 +73,21 @@ where
7273
pub(crate) _ty: PhantomData<R>,
7374
}
7475

76+
impl<M, F, R> Clone for LowLevelILExpression<'_, M, F, R>
77+
where
78+
M: FunctionMutability,
79+
F: FunctionForm,
80+
R: ExpressionResultType,
81+
{
82+
fn clone(&self) -> Self {
83+
Self {
84+
function: self.function,
85+
index: self.index,
86+
_ty: PhantomData,
87+
}
88+
}
89+
}
90+
7591
impl<'func, M, F, R> LowLevelILExpression<'func, M, F, R>
7692
where
7793
M: FunctionMutability,

rust/src/low_level_il/instruction.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ where
6565
T: FnMut(&LowLevelILExpression<'func, M, F, ValueExpr>) -> VisitorAction;
6666
}
6767

68+
#[derive(Copy)]
6869
pub struct LowLevelILInstruction<'func, M, F>
6970
where
7071
M: FunctionMutability,
@@ -100,6 +101,19 @@ where
100101
}
101102
}
102103

104+
impl<M, F> Clone for LowLevelILInstruction<'_, M, F>
105+
where
106+
M: FunctionMutability,
107+
F: FunctionForm,
108+
{
109+
fn clone(&self) -> Self {
110+
Self {
111+
function: self.function,
112+
index: self.index,
113+
}
114+
}
115+
}
116+
103117
impl<M, F> Debug for LowLevelILInstruction<'_, M, F>
104118
where
105119
M: FunctionMutability,

0 commit comments

Comments
 (0)