Add Debug and Clone derives for stable mir datastructures
This commit is contained in:
parent
942cac1b8d
commit
480e042097
@ -1,12 +1,15 @@
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Body {
|
||||
pub blocks: Vec<BasicBlock>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BasicBlock {
|
||||
pub statements: Vec<Statement>,
|
||||
pub terminator: Terminator,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Terminator {
|
||||
Goto {
|
||||
target: usize,
|
||||
@ -41,21 +44,25 @@ pub enum Terminator {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Statement {
|
||||
Assign(Place, Operand),
|
||||
Nop,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Operand {
|
||||
Copy(Place),
|
||||
Move(Place),
|
||||
Constant(String),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Place {
|
||||
pub local: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SwitchTarget {
|
||||
pub value: u128,
|
||||
pub target: usize,
|
||||
|
@ -4,6 +4,7 @@
|
||||
// ignore-stage-1
|
||||
// ignore-cross-compile
|
||||
// ignore-remote
|
||||
// edition: 2021
|
||||
|
||||
#![feature(rustc_private)]
|
||||
|
||||
@ -43,11 +44,11 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
|
||||
assert_eq!(block.statements.len(), 1);
|
||||
match &block.statements[0] {
|
||||
stable_mir::mir::Statement::Assign(..) => {}
|
||||
_ => panic!(),
|
||||
other => panic!("{other:?}"),
|
||||
}
|
||||
match &block.terminator {
|
||||
stable_mir::mir::Terminator::Return => {}
|
||||
_ => panic!(),
|
||||
other => panic!("{other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user