Skip to content

Commit 9ec676d

Browse files
authored
Rollup merge of #112972 - nbdd0121:mir, r=davidtwco
Make `UnwindAction::Continue` explicit in MIR dump Makes it easier to spot unwinding related issues in MIR by making `UnwindAction::Continue` explicit, just like all other `UnwindAction`s.
2 parents b6144cd + 19ce326 commit 9ec676d

File tree

169 files changed

+346
-345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+346
-345
lines changed

compiler/rustc_middle/src/mir/terminator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ impl<'tcx> Debug for TerminatorKind<'tcx> {
272272

273273
let unwind = match self.unwind() {
274274
// Not needed or included in successors
275-
None | Some(UnwindAction::Continue) | Some(UnwindAction::Cleanup(_)) => None,
275+
None | Some(UnwindAction::Cleanup(_)) => None,
276+
Some(UnwindAction::Continue) => Some("unwind continue"),
276277
Some(UnwindAction::Unreachable) => Some("unwind unreachable"),
277278
Some(UnwindAction::Terminate) => Some("unwind terminate"),
278279
};

tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() -> () {
3636
StorageLive(_5);
3737
StorageLive(_6);
3838
_6 = _3;
39-
_5 = foo(move _6) -> bb1;
39+
_5 = foo(move _6) -> [return: bb1, unwind continue];
4040
}
4141

4242
bb1: {
@@ -45,7 +45,7 @@ fn main() -> () {
4545
_7 = _2;
4646
_8 = Len(_1);
4747
_9 = Lt(_7, _8);
48-
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2;
48+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue];
4949
}
5050

5151
bb2: {

tests/mir-opt/basic_assignment.main.ElaborateDrops.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
bb4: {
6060
StorageDead(_5);
61-
- drop(_4) -> bb5;
61+
- drop(_4) -> [return: bb5, unwind continue];
6262
+ goto -> bb5;
6363
}
6464

tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() -> () {
1919
StorageLive(_1);
2020
_2 = SizeOf(S);
2121
_3 = AlignOf(S);
22-
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1;
22+
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
2323
}
2424

2525
bb1: {
@@ -30,7 +30,7 @@ fn main() -> () {
3030

3131
bb2: {
3232
_1 = move _5;
33-
drop(_5) -> bb3;
33+
drop(_5) -> [return: bb3, unwind continue];
3434
}
3535

3636
bb3: {
@@ -45,7 +45,7 @@ fn main() -> () {
4545
StorageDead(_7);
4646
StorageDead(_6);
4747
_0 = const ();
48-
drop(_1) -> bb5;
48+
drop(_1) -> [return: bb5, unwind continue];
4949
}
5050

5151
bb5: {

tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]>
3030
}
3131

3232
bb2: {
33-
assert(const false, "`async fn` resumed after completion") -> bb2;
33+
assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind continue];
3434
}
3535

3636
bb3: {

tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
310310
}
311311

312312
bb28: {
313-
assert(const false, "`async fn` resumed after completion") -> bb28;
313+
assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind continue];
314314
}
315315

316316
bb29: {

tests/mir-opt/building/custom/terminators.direct_call.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn direct_call(_1: i32) -> i32 {
44
let mut _0: i32;
55

66
bb0: {
7-
_0 = ident::<i32>(_1) -> bb1;
7+
_0 = ident::<i32>(_1) -> [return: bb1, unwind continue];
88
}
99

1010
bb1: {

tests/mir-opt/building/custom/terminators.drop_first.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn drop_first(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () {
44
let mut _0: ();
55

66
bb0: {
7-
drop(_1) -> bb1;
7+
drop(_1) -> [return: bb1, unwind continue];
88
}
99

1010
bb1: {

tests/mir-opt/building/custom/terminators.drop_second.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn drop_second(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () {
44
let mut _0: ();
55

66
bb0: {
7-
drop(_2) -> bb1;
7+
drop(_2) -> [return: bb1, unwind continue];
88
}
99

1010
bb1: {

tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn indirect_call(_1: i32, _2: fn(i32) -> i32) -> i32 {
44
let mut _0: i32;
55

66
bb0: {
7-
_0 = _2(_1) -> bb1;
7+
_0 = _2(_1) -> [return: bb1, unwind continue];
88
}
99

1010
bb1: {

0 commit comments

Comments
 (0)