Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions rust/src/low_level_il/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::basic_block::{BasicBlock, BlockContext};

use super::*;

#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct LowLevelILBlock<'func, M, F>
where
M: FunctionMutability,
Expand Down Expand Up @@ -63,18 +63,6 @@ where
}
}

impl<M, F> Clone for LowLevelILBlock<'_, M, F>
where
M: FunctionMutability,
F: FunctionForm,
{
fn clone(&self) -> Self {
LowLevelILBlock {
function: self.function,
}
}
}

pub struct LowLevelILBlockIter<'func, M, F>
where
M: FunctionMutability,
Expand Down
16 changes: 16 additions & 0 deletions rust/src/low_level_il/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions rust/src/low_level_il/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand All @@ -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 {}

Expand Down
1 change: 1 addition & 0 deletions rust/src/low_level_il/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading