Skip to content

Commit bddc1e2

Browse files
committed
add a comment: MatchPair and ExprUseVisitor must stay in sync
1 parent 6890336 commit bddc1e2

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
@@ -339,6 +339,12 @@ impl<'tcx> MatchPairTree<'tcx> {
339339

340340
if let Some(test_case) = test_case {
341341
// This pattern is refutable, so push a new match-pair node.
342+
//
343+
// Note: unless test_case is TestCase::Or, place must not be None.
344+
// This means that the closure capture analysis in
345+
// rustc_hir_typeck::upvar, and in particular the pattern handling
346+
// code of ExprUseVisitor, must capture all of the places we'll use.
347+
// Make sure to keep these two parts in sync!
342348
match_pairs.push(MatchPairTree {
343349
place,
344350
test_case,

0 commit comments

Comments
 (0)