Skip to content

Commit 756a0b2

Browse files
committed
add a comment: MatchPair and ExprUseVisitor must stay in sync
1 parent 16197bd commit 756a0b2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_mir_build/src/builder/matches/match_pair.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,12 @@ impl<'tcx> MatchPairTree<'tcx> {
300300

301301
if let Some(test_case) = test_case {
302302
// This pattern is refutable, so push a new match-pair node.
303+
//
304+
// Note: unless test_case is TestCase::Or, place must not be None.
305+
// This means that the closure capture analysis in
306+
// rustc_hir_typeck::upvar, and in particular the pattern handling
307+
// code of ExprUseVisitor, must capture all of the places we'll use.
308+
// Make sure to keep these two parts in sync!
303309
match_pairs.push(MatchPairTree {
304310
place,
305311
test_case,

0 commit comments

Comments
 (0)