Skip to content

Commit 2131b15

Browse files
committed
Check which blocks are cleanup in mir-opt tests
1 parent 2cfd644 commit 2131b15

10 files changed

+22
-23
lines changed

src/librustc_mir/util/pretty.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,8 @@ where
317317
let data = &mir[block];
318318

319319
// Basic block label at the top.
320-
let cleanup_text = if data.is_cleanup { " // cleanup" } else { "" };
321-
let lbl = format!("{}{:?}: {{", INDENT, block);
322-
writeln!(w, "{0:1$}{2}", lbl, ALIGN, cleanup_text)?;
320+
let cleanup_text = if data.is_cleanup { " (cleanup)" } else { "" };
321+
writeln!(w, "{}{:?}{}: {{", INDENT, block, cleanup_text)?;
323322

324323
// List of statements in the middle.
325324
let mut current_location = Location {

src/test/mir-opt/basic_assignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn main() {
4848
// drop(_6) -> [return: bb6, unwind: bb4];
4949
// }
5050
// ...
51-
// bb5: {
51+
// bb5 (cleanup): {
5252
// drop(_6) -> bb4;
5353
// }
5454
// END rustc.main.SimplifyCfg-initial.after.mir

src/test/mir-opt/box_expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Drop for S {
3838
// (*_2) = const S::new() -> [return: bb2, unwind: bb3];
3939
// }
4040
//
41-
// bb1: {
41+
// bb1 (cleanup): {
4242
// resume;
4343
// }
4444
//
@@ -47,7 +47,7 @@ impl Drop for S {
4747
// drop(_2) -> bb4;
4848
// }
4949
//
50-
// bb3: {
50+
// bb3 (cleanup): {
5151
// drop(_2) -> bb1;
5252
// }
5353
//
@@ -62,11 +62,11 @@ impl Drop for S {
6262
// drop(_4) -> [return: bb8, unwind: bb6];
6363
// }
6464
//
65-
// bb6: {
65+
// bb6 (cleanup): {
6666
// drop(_1) -> bb1;
6767
// }
6868
//
69-
// bb7: {
69+
// bb7 (cleanup): {
7070
// drop(_4) -> bb6;
7171
// }
7272
//

src/test/mir-opt/issue-38669.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
// FakeRead(ForLet, _1);
1919
// goto -> bb2;
2020
// }
21-
// bb1: {
21+
// bb1 (cleanup): {
2222
// resume;
2323
// }
2424
// bb2: {

src/test/mir-opt/issue-49232.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn main() {
4343
// FakeRead(ForMatchedPlace, _3);
4444
// switchInt(_3) -> [false: bb9, otherwise: bb8];
4545
// }
46-
// bb4: {
46+
// bb4 (cleanup): {
4747
// resume;
4848
// }
4949
// bb5: {

src/test/mir-opt/loop_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
// END RUST SOURCE
1919
// START rustc.main.SimplifyCfg-qualify-consts.after.mir
2020
// ...
21-
// bb1: { // The cleanup block
21+
// bb1 (cleanup): {
2222
// resume;
2323
// }
2424
// ...

src/test/mir-opt/match_false_edges.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() {
4747
// _3 = discriminant(_2);
4848
// switchInt(move _3) -> [0isize: bb4, 1isize: bb2, otherwise: bb7];
4949
// }
50-
// bb1: {
50+
// bb1 (cleanup): {
5151
// resume;
5252
// }
5353
// bb2: {
@@ -116,7 +116,7 @@ fn main() {
116116
// _3 = discriminant(_2);
117117
// switchInt(move _3) -> [0isize: bb3, 1isize: bb2, otherwise: bb7];
118118
// }
119-
// bb1: {
119+
// bb1 (cleanup): {
120120
// resume;
121121
// }
122122
// bb2: {
@@ -185,7 +185,7 @@ fn main() {
185185
// _3 = discriminant(_2);
186186
// switchInt(move _3) -> [1isize: bb2, otherwise: bb3];
187187
// }
188-
// bb1: {
188+
// bb1 (cleanup): {
189189
// resume;
190190
// }
191191
// bb2: {

src/test/mir-opt/packed-struct-drop-aligned.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ impl Drop for Droppy {
3838
// _6 = move (_1.0: Aligned);
3939
// drop(_6) -> [return: bb4, unwind: bb3];
4040
// }
41-
// bb1: {
41+
// bb1 (cleanup): {
4242
// resume;
4343
// }
4444
// bb2: {
4545
// StorageDead(_1);
4646
// return;
4747
// }
48-
// bb3: {
48+
// bb3 (cleanup): {
4949
// (_1.0: Aligned) = move _4;
5050
// drop(_1) -> bb1;
5151
// }

src/test/mir-opt/remove_fake_borrows.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn main() {
6363
// StorageDead(_8);
6464
// return;
6565
// }
66-
// bb10: {
66+
// bb10 (cleanup): {
6767
// resume;
6868
// }
6969
// END rustc.match_guard.CleanupNonCodegenStatements.before.mir
@@ -114,7 +114,7 @@ fn main() {
114114
// StorageDead(_8);
115115
// return;
116116
// }
117-
// bb10: {
117+
// bb10 (cleanup): {
118118
// resume;
119119
// }
120120
// END rustc.match_guard.CleanupNonCodegenStatements.after.mir

src/test/mir-opt/unusual-item-types.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() {
2222
// _0 = const 2i32;
2323
// return;
2424
// }
25-
// bb1: {
25+
// bb1 (cleanup): {
2626
// resume;
2727
// }
2828
// END rustc.{{impl}}-ASSOCIATED_CONSTANT.mir_map.0.mir
@@ -32,7 +32,7 @@ fn main() {
3232
// _0 = const 5isize;
3333
// return;
3434
// }
35-
// bb1: {
35+
// bb1 (cleanup): {
3636
// resume;
3737
// }
3838
// END rustc.E-V-{{constant}}.mir_map.0.mir
@@ -44,16 +44,16 @@ fn main() {
4444
// bb1: {
4545
// return;
4646
// }
47-
// bb2: {
47+
// bb2 (cleanup): {
4848
// resume;
4949
// }
5050
// bb3: {
5151
// goto -> bb1;
5252
// }
53-
// bb4: {
53+
// bb4 (cleanup): {
5454
// goto -> bb2;
5555
// }
56-
// bb5: {
56+
// bb5 (cleanup): {
5757
// drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> bb4;
5858
// }
5959
// bb6: {

0 commit comments

Comments
 (0)