Skip to content

Commit 411fcb6

Browse files
committed
Rename test to pick_test_for_match_pair
1 parent 03bfa36 commit 411fcb6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1809,8 +1809,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
18091809
/// [`Range`]: TestKind::Range
18101810
fn pick_test(&mut self, candidates: &[&mut Candidate<'_, 'tcx>]) -> (Place<'tcx>, Test<'tcx>) {
18111811
// Extract the match-pair from the highest priority candidate
1812-
let match_pair = &candidates.first().unwrap().match_pairs[0];
1813-
let test = self.test(match_pair);
1812+
let match_pair = &candidates[0].match_pairs[0];
1813+
let test = self.pick_test_for_match_pair(match_pair);
18141814
// Unwrap is ok after simplification.
18151815
let match_place = match_pair.place.unwrap();
18161816
debug!(?test, ?match_pair);

compiler/rustc_mir_build/src/build/matches/test.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2626
/// Identifies what test is needed to decide if `match_pair` is applicable.
2727
///
2828
/// It is a bug to call this with a not-fully-simplified pattern.
29-
pub(super) fn test<'pat>(&mut self, match_pair: &MatchPairTree<'pat, 'tcx>) -> Test<'tcx> {
29+
pub(super) fn pick_test_for_match_pair<'pat>(
30+
&mut self,
31+
match_pair: &MatchPairTree<'pat, 'tcx>,
32+
) -> Test<'tcx> {
3033
let kind = match match_pair.test_case {
3134
TestCase::Variant { adt_def, variant_index: _ } => TestKind::Switch { adt_def },
3235

0 commit comments

Comments
 (0)