@@ -1561,6 +1561,25 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1561
1561
otherwise_block
1562
1562
}
1563
1563
1564
+ /// Given a match-pair that corresponds to an or-pattern, expand each subpattern into a new
1565
+ /// subcandidate. Any candidate that has been expanded that way should be passed to
1566
+ /// `finalize_or_candidate` after its subcandidates have been processed.
1567
+ fn create_or_subcandidates < ' pat > (
1568
+ & mut self ,
1569
+ candidate : & mut Candidate < ' pat , ' tcx > ,
1570
+ match_pair : MatchPair < ' pat , ' tcx > ,
1571
+ ) {
1572
+ let TestCase :: Or { pats } = match_pair. test_case else { bug ! ( ) } ;
1573
+ debug ! ( "expanding or-pattern: candidate={:#?}\n pats={:#?}" , candidate, pats) ;
1574
+ candidate. or_span = Some ( match_pair. pattern . span ) ;
1575
+ candidate. subcandidates = pats
1576
+ . into_vec ( )
1577
+ . into_iter ( )
1578
+ . map ( |flat_pat| Candidate :: from_flat_pat ( flat_pat, candidate. has_guard ) )
1579
+ . collect ( ) ;
1580
+ candidate. subcandidates [ 0 ] . false_edge_start_block = candidate. false_edge_start_block ;
1581
+ }
1582
+
1564
1583
/// Simplify subcandidates and process any leftover match pairs. The candidate should have been
1565
1584
/// expanded with `create_or_subcandidates`.
1566
1585
///
@@ -1661,25 +1680,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1661
1680
}
1662
1681
}
1663
1682
1664
- /// Given a match-pair that corresponds to an or-pattern, expand each subpattern into a new
1665
- /// subcandidate. Any candidate that has been expanded that way should be passed to
1666
- /// `finalize_or_candidate` after its subcandidates have been processed.
1667
- fn create_or_subcandidates < ' pat > (
1668
- & mut self ,
1669
- candidate : & mut Candidate < ' pat , ' tcx > ,
1670
- match_pair : MatchPair < ' pat , ' tcx > ,
1671
- ) {
1672
- let TestCase :: Or { pats } = match_pair. test_case else { bug ! ( ) } ;
1673
- debug ! ( "expanding or-pattern: candidate={:#?}\n pats={:#?}" , candidate, pats) ;
1674
- candidate. or_span = Some ( match_pair. pattern . span ) ;
1675
- candidate. subcandidates = pats
1676
- . into_vec ( )
1677
- . into_iter ( )
1678
- . map ( |flat_pat| Candidate :: from_flat_pat ( flat_pat, candidate. has_guard ) )
1679
- . collect ( ) ;
1680
- candidate. subcandidates [ 0 ] . false_edge_start_block = candidate. false_edge_start_block ;
1681
- }
1682
-
1683
1683
/// Try to merge all of the subcandidates of the given candidate into one. This avoids
1684
1684
/// exponentially large CFGs in cases like `(1 | 2, 3 | 4, ...)`. The candidate should have been
1685
1685
/// expanded with `create_or_subcandidates`.
0 commit comments