@@ -26,7 +26,6 @@ use crate::builder::{
26
26
27
27
// helper functions, broken out by category:
28
28
mod match_pair;
29
- mod simplify;
30
29
mod test;
31
30
mod util;
32
31
@@ -989,16 +988,16 @@ impl<'tcx> PatternExtraData<'tcx> {
989
988
/// A pattern in a form suitable for lowering the match tree, with all irrefutable
990
989
/// patterns simplified away, and or-patterns sorted to the end.
991
990
///
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.
995
994
///
996
995
/// Will typically be incorporated into a [`Candidate`].
997
996
#[ derive( Debug , Clone ) ]
998
997
struct FlatPat < ' tcx > {
999
998
/// 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.
1002
1001
match_pairs : Vec < MatchPairTree < ' tcx > > ,
1003
1002
1004
1003
extra_data : PatternExtraData < ' tcx > ,
@@ -1017,7 +1016,7 @@ impl<'tcx> FlatPat<'tcx> {
1017
1016
is_never : pattern. is_never_pattern ( ) ,
1018
1017
} ;
1019
1018
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) ;
1021
1020
1022
1021
Self { match_pairs, extra_data }
1023
1022
}
@@ -1271,6 +1270,8 @@ pub(crate) struct MatchPairTree<'tcx> {
1271
1270
/// parent has succeeded. For example, the pattern `Some(3)` might have an
1272
1271
/// outer match pair that tests for the variant `Some`, and then a subpair
1273
1272
/// that tests its field for the value `3`.
1273
+ ///
1274
+ /// Invariant: Or-patterns must be sorted to the end.
1274
1275
subpairs : Vec < Self > ,
1275
1276
1276
1277
/// Type field of the pattern this node was created from.
0 commit comments