Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5bf50e6

Browse files
committed
Move a function
1 parent9dcaa7f commit5bf50e6

File tree

1 file changed

+19
-19
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+19
-19
lines changed

‎compiler/rustc_mir_build/src/build/matches/mod.rs‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,25 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
16241624
otherwise_block
16251625
}
16261626

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+
fncreate_or_subcandidates<'pat>(
1631+
&mutself,
1632+
candidate:&mutCandidate<'pat,'tcx>,
1633+
match_pair:MatchPair<'pat,'tcx>,
1634+
){
1635+
letTestCase::Or{ pats} = match_pair.test_caseelse{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+
16271646
/// Simplify subcandidates and process any leftover match pairs. The candidate should have been
16281647
/// expanded with `create_or_subcandidates`.
16291648
///
@@ -1724,25 +1743,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
17241743
}
17251744
}
17261745

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-
fncreate_or_subcandidates<'pat>(
1731-
&mutself,
1732-
candidate:&mutCandidate<'pat,'tcx>,
1733-
match_pair:MatchPair<'pat,'tcx>,
1734-
){
1735-
letTestCase::Or{ pats} = match_pair.test_caseelse{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-
17461746
/// Try to merge all of the subcandidates of the given candidate into one. This avoids
17471747
/// exponentially large CFGs in cases like `(1 | 2, 3 | 4, ...)`. The candidate should have been
17481748
/// expanded with `create_or_subcandidates`.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp