Skip to content

Commit f1b5225

Browse files
committed
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.
2 parents cef4a3e + 6f8b69f commit f1b5225

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc_mir/util/pretty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ pub fn write_basic_block(tcx: TyCtxt,
188188
let data = &mir[block];
189189

190190
// Basic block label at the top.
191-
writeln!(w, "{}{:?}: {{", INDENT, block)?;
191+
let cleanup_text = if data.is_cleanup { " // cleanup" } else { "" };
192+
let lbl = format!("{}{:?}: {{", INDENT, block);
193+
writeln!(w, "{0:1$}{2}", lbl, ALIGN, cleanup_text)?;
192194

193195
// List of statements in the middle.
194196
let mut current_location = Location { block: block, statement_index: 0 };

0 commit comments

Comments
 (0)