@@ -941,13 +941,28 @@ impl ConstructorSet {
941
941
}
942
942
}
943
943
944
- /// Split the set into two vecs `split` and `missing`, respecting the following:
944
+ /// This is the core logical operation of exhaustiveness checking.
945
+ /// Given a set of patterns in a match, we look at their head constructors and ask the
946
+ /// questions: which constructors are present in the match, and which are missing.
947
+ /// For this we first need to know about the full set of constructors for this type, which is
948
+ /// represented by this `ConstructorSet`. We then construct two lists of constructors.
949
+ ///
950
+ /// Formally, this returns two vecs `split` and `missing`, respecting the following constraints:
945
951
/// - `split` covers the whole type
946
- /// - constructors in `split` and `missing` are split for the `ctors` list
947
- /// - all non-wildcards in `ctors` cover something in `split` (including `Opaques`)
948
- /// - no non-wildcard in `ctors` covers anything in `missing`
949
- /// - if we replace any `Wildcard`/`Missing` in `split` with all of `missing`, this also
952
+ /// - `split` is made of:
953
+ /// - at most one wildcard (`Wildcard` or `Missing`)
954
+ /// - non-wildcard constructors that are each covered by some non-wildcard constructor in `ctors`
955
+ /// - together, the non-wildcard constructors in `split` cover all the non-wildcard
956
+ /// constructor in `ctors`, including `Opaques`
957
+ /// - non-wildcards in `ctors` do no cover anything in `missing`
958
+ /// - if we replace the `Wildcard`/`Missing` in `split` with all of `missing`, this also
950
959
/// covers the whole type
960
+ /// - constructors in `split` and `missing` are split for the `ctors` list; in other words,
961
+ /// they are either fully included in or disjoint from each constructor in `ctors`
962
+ ///
963
+ /// Note in particular that wildcards in `ctors` are irrelevant; they do not change which
964
+ /// constructors are present.
965
+ /// FIXME(Nadrieril): examples?
951
966
pub ( super ) fn split < ' a , ' tcx > (
952
967
& self ,
953
968
pcx : & PatCtxt < ' _ , ' _ , ' tcx > ,
0 commit comments