Skip to content

Commit 5f90dbd

Browse files
committed
Make Candidate private
1 parent c7e6f88 commit 5f90dbd

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/librustc_mir_build/build/matches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
659659
}
660660

661661
#[derive(Debug)]
662-
crate struct Candidate<'pat, 'tcx> {
662+
struct Candidate<'pat, 'tcx> {
663663
/// `Span` of the original pattern that gave rise to this candidate
664664
span: Span,
665665

src/librustc_mir_build/build/matches/simplify.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
3838
///
3939
/// only generates a single switch. If this happens this method returns
4040
/// `true`.
41-
crate fn simplify_candidate<'pat>(&mut self, candidate: &mut Candidate<'pat, 'tcx>) -> bool {
41+
pub(super) fn simplify_candidate<'pat>(
42+
&mut self,
43+
candidate: &mut Candidate<'pat, 'tcx>,
44+
) -> bool {
4245
// repeatedly simplify match pairs until fixed point is reached
4346
loop {
4447
let match_pairs = mem::take(&mut candidate.match_pairs);

src/librustc_mir_build/build/matches/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2424
/// Identifies what test is needed to decide if `match_pair` is applicable.
2525
///
2626
/// It is a bug to call this with a simplifiable pattern.
27-
crate fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx> {
27+
pub(super) fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx> {
2828
match *match_pair.pattern.kind {
2929
PatKind::Variant { ref adt_def, substs: _, variant_index: _, subpatterns: _ } => Test {
3030
span: match_pair.pattern.span,
@@ -81,7 +81,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
8181
}
8282
}
8383

84-
crate fn add_cases_to_switch<'pat>(
84+
pub(super) fn add_cases_to_switch<'pat>(
8585
&mut self,
8686
test_place: &Place<'tcx>,
8787
candidate: &Candidate<'pat, 'tcx>,
@@ -125,7 +125,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
125125
}
126126
}
127127

128-
crate fn add_variants_to_switch<'pat>(
128+
pub(super) fn add_variants_to_switch<'pat>(
129129
&mut self,
130130
test_place: &Place<'tcx>,
131131
candidate: &Candidate<'pat, 'tcx>,
@@ -152,7 +152,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
152152
}
153153
}
154154

155-
crate fn perform_test(
155+
pub(super) fn perform_test(
156156
&mut self,
157157
block: BasicBlock,
158158
place: &Place<'tcx>,
@@ -498,7 +498,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
498498
/// that it *doesn't* apply. For now, we return false, indicate that the
499499
/// test does not apply to this candidate, but it might be we can get
500500
/// tighter match code if we do something a bit different.
501-
crate fn sort_candidate<'pat>(
501+
pub(super) fn sort_candidate<'pat>(
502502
&mut self,
503503
test_place: &Place<'tcx>,
504504
test: &Test<'tcx>,

0 commit comments

Comments
 (0)