@@ -26,7 +26,6 @@ use crate::builder::{
2626
2727// helper functions, broken out by category:
2828mod match_pair;
29- mod simplify;
3029mod test;
3130mod util;
3231
@@ -989,16 +988,16 @@ impl<'tcx> PatternExtraData<'tcx> {
989988/// A pattern in a form suitable for lowering the match tree, with all irrefutable
990989/// patterns simplified away, and or-patterns sorted to the end.
991990///
992- /// Here, "flat" indicates that the pattern's match pairs have been recursively
993- /// simplified by [`Builder::simplify_match_pairs`] . They are not necessarily
994- /// flat in an absolute sense.
991+ /// Here, "flat" indicates that irrefutable nodes in the pattern tree have been
992+ /// recursively replaced with their refutable subpatterns . They are not
993+ /// necessarily flat in an absolute sense.
995994///
996995/// Will typically be incorporated into a [`Candidate`].
997996#[ derive( Debug , Clone ) ]
998997struct FlatPat < ' tcx > {
999998 /// To match the pattern, all of these must be satisfied...
1000- // Invariant: all the match pairs are recursively simplified.
1001- // Invariant: or -patterns must be sorted to the end.
999+ /// ---
1000+ /// Invariant: Or -patterns must be sorted to the end.
10021001 match_pairs : Vec < MatchPairTree < ' tcx > > ,
10031002
10041003 extra_data : PatternExtraData < ' tcx > ,
@@ -1017,7 +1016,7 @@ impl<'tcx> FlatPat<'tcx> {
10171016 is_never : pattern. is_never_pattern ( ) ,
10181017 } ;
10191018 MatchPairTree :: for_pattern ( place, pattern, cx, & mut match_pairs, & mut extra_data) ;
1020- cx . simplify_match_pairs ( & mut match_pairs, & mut extra_data ) ;
1019+ match_pair :: sort_match_pairs ( & mut match_pairs) ;
10211020
10221021 Self { match_pairs, extra_data }
10231022 }
@@ -1271,6 +1270,8 @@ pub(crate) struct MatchPairTree<'tcx> {
12711270 /// parent has succeeded. For example, the pattern `Some(3)` might have an
12721271 /// outer match pair that tests for the variant `Some`, and then a subpair
12731272 /// that tests its field for the value `3`.
1273+ ///
1274+ /// Invariant: Or-patterns must be sorted to the end.
12741275 subpairs : Vec < Self > ,
12751276
12761277 /// Type field of the pattern this node was created from.
0 commit comments