about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-03-16 16:17:25 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-03-16 16:17:25 +0000
commit480e042097573ad518e43cf2ee8f17ecb755693a (patch)
treee369d70ac7b493c1d163fdd2d7afa2e8d9265139
parent942cac1b8d9b9fa6a5ba372aaff815f565f302d0 (diff)
downloadrust-480e042097573ad518e43cf2ee8f17ecb755693a.tar.gz
rust-480e042097573ad518e43cf2ee8f17ecb755693a.zip
Add Debug and Clone derives for stable mir datastructures
-rw-r--r--compiler/rustc_smir/src/stable_mir/mir/body.rs7
-rw-r--r--tests/ui-fulldeps/stable-mir/crate-info.rs5
2 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_smir/src/stable_mir/mir/body.rs b/compiler/rustc_smir/src/stable_mir/mir/body.rs
index 613141952a7..c504065c993 100644
--- a/compiler/rustc_smir/src/stable_mir/mir/body.rs
+++ b/compiler/rustc_smir/src/stable_mir/mir/body.rs
@@ -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,
diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs
index 95797ddf073..99b653f20b6 100644
--- a/tests/ui-fulldeps/stable-mir/crate-info.rs
+++ b/tests/ui-fulldeps/stable-mir/crate-info.rs
@@ -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:?}"),
     }
 }