about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-10-01 19:57:01 +0000
committerbors <bors@rust-lang.org>2017-10-01 19:57:01 +0000
commitf1b5225e8b67adab52dda2b5ed5c8b805b716a6d (patch)
tree1060b50301f584faff986fd44696cd40d995ec9a
parentcef4a3ebfaa7809d6ab8d8578b14160a83215321 (diff)
parent6f8b69fcd1a5a729449bd44c15805132398734d3 (diff)
Auto merge of #44919 - diwic:79-pretty-mir, r=arielb1
Mir pretty print: Add cleanup comment

I found it useful to add a comment indicating whether or not a
BasicBlock is a cleanup block or not. Hopefully you'll find it
useful too.
-rw-r--r--src/librustc_mir/util/pretty.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs
index 0811783a9e5..9e1f05f6d2f 100644
--- a/src/librustc_mir/util/pretty.rs
+++ b/src/librustc_mir/util/pretty.rs
@@ -188,7 +188,9 @@ pub fn write_basic_block(tcx: TyCtxt,
     let data = &mir[block];
 
     // Basic block label at the top.
-    writeln!(w, "{}{:?}: {{", INDENT, block)?;
+    let cleanup_text = if data.is_cleanup { " // cleanup" } else { "" };
+    let lbl = format!("{}{:?}: {{", INDENT, block);
+    writeln!(w, "{0:1$}{2}", lbl, ALIGN, cleanup_text)?;
 
     // List of statements in the middle.
     let mut current_location = Location { block: block, statement_index: 0 };