Move a function · rust-lang/rust@5bf50e6 (original) (raw)
`@@ -1624,6 +1624,25 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
`
1624
1624
` otherwise_block
`
1625
1625
`}
`
1626
1626
``
``
1627
`+
/// Given a match-pair that corresponds to an or-pattern, expand each subpattern into a new
`
``
1628
`+
/// subcandidate. Any candidate that has been expanded that way should be passed to
`
``
1629
`` +
/// finalize_or_candidate
after its subcandidates have been processed.
``
``
1630
`+
fn create_or_subcandidates<'pat>(
`
``
1631
`+
&mut self,
`
``
1632
`+
candidate: &mut Candidate<'pat, 'tcx>,
`
``
1633
`+
match_pair: MatchPair<'pat, 'tcx>,
`
``
1634
`+
) {
`
``
1635
`+
let TestCase::Or { pats } = match_pair.test_case else { bug!() };
`
``
1636
`+
debug!("expanding or-pattern: candidate={:#?}\npats={:#?}", candidate, pats);
`
``
1637
`+
candidate.or_span = Some(match_pair.pattern.span);
`
``
1638
`+
candidate.subcandidates = pats
`
``
1639
`+
.into_vec()
`
``
1640
`+
.into_iter()
`
``
1641
`+
.map(|flat_pat| Candidate::from_flat_pat(flat_pat, candidate.has_guard))
`
``
1642
`+
.collect();
`
``
1643
`+
candidate.subcandidates[0].false_edge_start_block = candidate.false_edge_start_block;
`
``
1644
`+
}
`
``
1645
+
1627
1646
`/// Simplify subcandidates and process any leftover match pairs. The candidate should have been
`
1628
1647
`` /// expanded with create_or_subcandidates
.
``
1629
1648
`///
`
`@@ -1724,25 +1743,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
`
1724
1743
`}
`
1725
1744
`}
`
1726
1745
``
1727
``
`-
/// Given a match-pair that corresponds to an or-pattern, expand each subpattern into a new
`
1728
``
`-
/// subcandidate. Any candidate that has been expanded that way should be passed to
`
1729
``
`` -
/// finalize_or_candidate
after its subcandidates have been processed.
``
1730
``
`-
fn create_or_subcandidates<'pat>(
`
1731
``
`-
&mut self,
`
1732
``
`-
candidate: &mut Candidate<'pat, 'tcx>,
`
1733
``
`-
match_pair: MatchPair<'pat, 'tcx>,
`
1734
``
`-
) {
`
1735
``
`-
let TestCase::Or { pats } = match_pair.test_case else { bug!() };
`
1736
``
`-
debug!("expanding or-pattern: candidate={:#?}\npats={:#?}", candidate, pats);
`
1737
``
`-
candidate.or_span = Some(match_pair.pattern.span);
`
1738
``
`-
candidate.subcandidates = pats
`
1739
``
`-
.into_vec()
`
1740
``
`-
.into_iter()
`
1741
``
`-
.map(|flat_pat| Candidate::from_flat_pat(flat_pat, candidate.has_guard))
`
1742
``
`-
.collect();
`
1743
``
`-
candidate.subcandidates[0].false_edge_start_block = candidate.false_edge_start_block;
`
1744
``
`-
}
`
1745
``
-
1746
1746
`/// Try to merge all of the subcandidates of the given candidate into one. This avoids
`
1747
1747
`` /// exponentially large CFGs in cases like (1 | 2, 3 | 4, ...)
. The candidate should have been
``
1748
1748
`` /// expanded with create_or_subcandidates
.
``