Skip to content

Commit d51b5cd

Browse files
committed
Clean up MIR match lowering
* Adjust fake borrows to only be live over guards. * Remove unused `slice_len_checked` field. * Split the methods on builder into those for matches and those for all kinds of pattern bindings.
1 parent c15437c commit d51b5cd

File tree

7 files changed

+838
-804
lines changed

7 files changed

+838
-804
lines changed

src/librustc_mir/build/matches/mod.rs

Lines changed: 480 additions & 366 deletions
Large diffs are not rendered by default.

src/librustc_mir/build/matches/test.rs

Lines changed: 99 additions & 167 deletions
Large diffs are not rendered by default.

src/librustc_mir/build/matches/util.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ impl<'pat, 'tcx> MatchPair<'pat, 'tcx> {
7272
MatchPair {
7373
place,
7474
pattern,
75-
slice_len_checked: false,
7675
}
7776
}
7877
}

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,46 @@ fn main() {
4141
// StorageLive(_3);
4242
// _3 = const true;
4343
// FakeRead(ForMatchedPlace, _3);
44-
// switchInt(_3) -> [false: bb11, otherwise: bb10];
44+
// switchInt(_3) -> [false: bb9, otherwise: bb8];
4545
// }
4646
// bb4: {
4747
// resume;
4848
// }
4949
// bb5: {
50-
// _2 = const 4i32;
51-
// goto -> bb14;
50+
// falseEdges -> [real: bb12, imaginary: bb6];
5251
// }
5352
// bb6: {
54-
// _0 = ();
55-
// goto -> bb15;
53+
// falseEdges -> [real: bb14, imaginary: bb7];
5654
// }
5755
// bb7: {
58-
// falseEdges -> [real: bb12, imaginary: bb8];
56+
// unreachable;
5957
// }
6058
// bb8: {
61-
// falseEdges -> [real: bb13, imaginary: bb9];
59+
// goto -> bb6;
6260
// }
6361
// bb9: {
64-
// unreachable;
62+
// goto -> bb5;
6563
// }
6664
// bb10: {
67-
// goto -> bb8;
65+
// FakeRead(ForLet, _2);
66+
// StorageDead(_3);
67+
// StorageLive(_6);
68+
// _6 = &_2;
69+
// _5 = const std::mem::drop(move _6) -> [return: bb19, unwind: bb4];
6870
// }
6971
// bb11: {
70-
// goto -> bb7;
72+
// _2 = const 4i32;
73+
// goto -> bb10;
7174
// }
7275
// bb12: {
73-
// goto -> bb5;
76+
// goto -> bb11;
7477
// }
7578
// bb13: {
76-
// goto -> bb6;
79+
// _0 = ();
80+
// goto -> bb15;
7781
// }
7882
// bb14: {
79-
// FakeRead(ForLet, _2);
80-
// StorageDead(_3);
81-
// StorageLive(_6);
82-
// _6 = &_2;
83-
// _5 = const std::mem::drop(move _6) -> [return: bb19, unwind: bb4];
83+
// goto -> bb13;
8484
// }
8585
// bb15: {
8686
// StorageDead(_3);
@@ -96,7 +96,7 @@ fn main() {
9696
// }
9797
// bb18: {
9898
// StorageDead(_4);
99-
// goto -> bb14;
99+
// goto -> bb10;
100100
// }
101101
// bb19: {
102102
// StorageDead(_6);

0 commit comments

Comments
 (0)