rust/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
Wesley Wiser 0a42dfc2fa Fix debugger stepping behavior around match expressions
Previously, we would set up the source lines for `match` expressions so
that the code generated to perform the test of the scrutinee was matched
to the line of the arm that required the test and then jump from the arm
block to the "next" block was matched to all of the lines in the `match`
expression.

While that makes sense, it has the side effect of causing strange
stepping behavior in debuggers.

I've changed the source information so that all of the generated tests
are sourced to `match {scrutinee}` and the jumps are sourced to the last
line of the block they are inside. This resolves the weird stepping
behavior in all debuggers and resolves some instances of "ambiguous
symbol" errors in WinDbg preventing the user from setting breakpoints at
`match` expressions.
2021-08-25 15:17:22 -04:00

107 lines
9.5 KiB
Diff

- // MIR for `main` before UninhabitedEnumBranching
+ // MIR for `main` after UninhabitedEnumBranching
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching.rs:19:11: 19:11
let _1: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6
let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19
let mut _3: isize; // in scope 0 at $DIR/uninhabited_enum_branching.rs:21:9: 21:20
let _4: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34
let _5: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24
let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6
let mut _7: Test2; // in scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19
let mut _8: isize; // in scope 0 at $DIR/uninhabited_enum_branching.rs:27:9: 27:17
let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24
bb0: {
StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6
StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19
discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19
_3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19
- switchInt(move _3) -> [0_isize: bb2, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 20:19
+ switchInt(move _3) -> bb1; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 20:19
}
bb1: {
StorageLive(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24
_5 = const "C"; // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24
// ty::Const
// + ty: &str
// + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
// mir::Constant
// + span: $DIR/uninhabited_enum_branching.rs:23:21: 23:24
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
_1 = &(*_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24
StorageDead(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:23: 23:24
goto -> bb4; // scope 0 at $DIR/uninhabited_enum_branching.rs:23:23: 23:24
}
bb2: {
_1 = const "A(Empty)"; // scope 0 at $DIR/uninhabited_enum_branching.rs:21:24: 21:34
// ty::Const
// + ty: &str
// + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
// mir::Constant
// + span: $DIR/uninhabited_enum_branching.rs:21:24: 21:34
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
goto -> bb4; // scope 0 at $DIR/uninhabited_enum_branching.rs:21:24: 21:34
}
bb3: {
StorageLive(_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34
_4 = const "B(Empty)"; // scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34
// ty::Const
// + ty: &str
// + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
// mir::Constant
// + span: $DIR/uninhabited_enum_branching.rs:22:24: 22:34
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
_1 = &(*_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34
StorageDead(_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:22:33: 22:34
goto -> bb4; // scope 0 at $DIR/uninhabited_enum_branching.rs:22:33: 22:34
}
bb4: {
StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:24:6: 24:7
StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:24:6: 24:7
StorageLive(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6
StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19
discriminant(_7) = 0; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19
_8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19
switchInt(move _8) -> [4_isize: bb6, otherwise: bb5]; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 26:19
}
bb5: {
StorageLive(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24
_9 = const "E"; // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24
// ty::Const
// + ty: &str
// + val: Value(Slice { data: Allocation { bytes: [69], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
// mir::Constant
// + span: $DIR/uninhabited_enum_branching.rs:28:21: 28:24
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [69], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
_6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24
StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:23: 28:24
goto -> bb7; // scope 0 at $DIR/uninhabited_enum_branching.rs:28:23: 28:24
}
bb6: {
_6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:27:21: 27:24
// ty::Const
// + ty: &str
// + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
// mir::Constant
// + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
goto -> bb7; // scope 0 at $DIR/uninhabited_enum_branching.rs:27:21: 27:24
}
bb7: {
StorageDead(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:29:6: 29:7
StorageDead(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:29:6: 29:7
_0 = const (); // scope 0 at $DIR/uninhabited_enum_branching.rs:19:11: 30:2
return; // scope 0 at $DIR/uninhabited_enum_branching.rs:30:2: 30:2
}
}