0a42dfc2fa
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.
61 lines
3.5 KiB
Diff
61 lines
3.5 KiB
Diff
- // MIR for `id_result` before SimplifyArmIdentity
|
|
+ // MIR for `id_result` after SimplifyArmIdentity
|
|
|
|
fn id_result(_1: Result<u8, i32>) -> Result<u8, i32> {
|
|
debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:16:14: 16:15
|
|
let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:16:37: 16:52
|
|
let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
|
let _3: u8; // in scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
|
let mut _4: u8; // in scope 0 at $DIR/simplify-arm.rs:18:21: 18:22
|
|
let _5: i32; // in scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
|
let mut _6: i32; // in scope 0 at $DIR/simplify-arm.rs:19:23: 19:24
|
|
scope 1 {
|
|
- debug x => _3; // in scope 1 at $DIR/simplify-arm.rs:18:12: 18:13
|
|
+ debug x => ((_0 as Ok).0: u8); // in scope 1 at $DIR/simplify-arm.rs:18:12: 18:13
|
|
}
|
|
scope 2 {
|
|
- debug y => _5; // in scope 2 at $DIR/simplify-arm.rs:19:13: 19:14
|
|
+ debug y => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify-arm.rs:19:13: 19:14
|
|
}
|
|
|
|
bb0: {
|
|
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:17:11: 17:12
|
|
switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:17:5: 17:12
|
|
}
|
|
|
|
bb1: {
|
|
- StorageLive(_5); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
|
- _5 = ((_1 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
|
- StorageLive(_6); // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
|
|
- _6 = _5; // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
|
|
- ((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
|
- discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
|
- StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25
|
|
- StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:24: 19:25
|
|
+ _0 = move _1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
|
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:19:24: 19:25
|
|
}
|
|
|
|
bb2: {
|
|
unreachable; // scope 0 at $DIR/simplify-arm.rs:17:11: 17:12
|
|
}
|
|
|
|
bb3: {
|
|
- StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
|
- _3 = ((_1 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
|
- StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
|
|
- _4 = _3; // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
|
|
- ((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
|
- discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
|
- StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23
|
|
- StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:22: 18:23
|
|
+ _0 = move _1; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
|
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:18:22: 18:23
|
|
}
|
|
|
|
bb4: {
|
|
return; // scope 0 at $DIR/simplify-arm.rs:21:2: 21:2
|
|
}
|
|
}
|
|
|