Skip to content

Commit 5f73b21

Browse files
committed
add a comment: MatchPair and ExprUseVisitor must stay in sync
1 parent 972b851 commit 5f73b21

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

294294
if let Some(test_case) = test_case {
295295
// This pattern is refutable, so push a new match-pair node.
296+
//
297+
// Note: unless test_case is TestCase::Or, place must not be None.
298+
// This means that the closure capture analysis in
299+
// rustc_hir_typeck::upvar, and in particular the pattern handling
300+
// code of ExprUseVisitor, must capture all of the places we'll use.
301+
// Make sure to keep these two parts in sync!
296302
match_pairs.push(MatchPairTree {
297303
place,
298304
test_case,

0 commit comments

Comments
 (0)