@@ -755,6 +755,13 @@ impl Slice {
755
755
}
756
756
}
757
757
758
+ /// A value can be decomposed into a constructor applied to some fields. This struct represents
759
+ /// the constructor. See also `Fields`.
760
+ ///
761
+ /// `pat_constructor` retrieves the constructor corresponding to a pattern.
762
+ /// `specialize_one_pattern` returns the list of fields corresponding to a pattern, given a
763
+ /// constructor. `Constructor::apply` reconstructs the pattern from a pair of `Constructor` and
764
+ /// `Fields`.
758
765
#[ derive( Clone , Debug , PartialEq ) ]
759
766
enum Constructor < ' tcx > {
760
767
/// The constructor for patterns that have a single constructor, like tuples, struct patterns
@@ -1107,8 +1114,14 @@ impl<'p, 'tcx> StructFields<'p, 'tcx> {
1107
1114
}
1108
1115
}
1109
1116
1110
- /// A value can be decomposed into a Constructor applied to some Fields. This struct represents
1111
- /// those fields, generalized to allow patterns in each field.
1117
+ /// A value can be decomposed into a constructor applied to some fields. This struct represents
1118
+ /// those fields, generalized to allow patterns in each field. See also `Constructor`.
1119
+ ///
1120
+ /// In some special cases of uninhabited types, we filter out those fields in the matrix so that
1121
+ /// the code can't observe they are uninhabited. But we do need to handle the full list of fields
1122
+ /// when going to/from a `Pat`, hence the distinction between filtered and unfiltered fields. As a
1123
+ /// rule, when going to/from the matrix, use the filtered fields; when going to/from `Pat`, use the
1124
+ /// full fields.
1112
1125
#[ derive( Debug , Clone ) ]
1113
1126
enum Fields < ' p , ' tcx > {
1114
1127
/// Fields of a struct, with special handling of uninhabited types.
0 commit comments