@@ -8,18 +8,18 @@ use std::ops::Index;
88use syntax_pos:: Span ;
99
1010/// Compactly stores a set of `R0 member of [R1...Rn]` constraints,
11- /// indexed by the region R0 .
11+ /// indexed by the region `R0` .
1212crate struct MemberConstraintSet < ' tcx , R >
1313where
1414 R : Copy + Hash + Eq ,
1515{
16- /// Stores the first "member" constraint for a given R0 . This is an
16+ /// Stores the first "member" constraint for a given `R0` . This is an
1717 /// index into the `constraints` vector below.
1818 first_constraints : FxHashMap < R , NllMemberConstraintIndex > ,
1919
2020 /// Stores the data about each `R0 member of [R1..Rn]` constraint.
2121 /// These are organized into a linked list, so each constraint
22- /// contains the index of the next constraint with the same R0 .
22+ /// contains the index of the next constraint with the same `R0` .
2323 constraints : IndexVec < NllMemberConstraintIndex , NllMemberConstraint < ' tcx > > ,
2424
2525 /// Stores the `R1..Rn` regions for *all* sets. For any given
@@ -38,10 +38,10 @@ crate struct NllMemberConstraint<'tcx> {
3838 /// The span where the hidden type was instantiated.
3939 crate definition_span : Span ,
4040
41- /// The hidden type in which R0 appears. (Used in error reporting.)
41+ /// The hidden type in which `R0` appears. (Used in error reporting.)
4242 crate hidden_ty : Ty < ' tcx > ,
4343
44- /// The region R0 .
44+ /// The region `R0` .
4545 crate member_region_vid : ty:: RegionVid ,
4646
4747 /// Index of `R1` in `choice_regions` vector from `MemberConstraintSet`.
@@ -68,6 +68,15 @@ impl Default for MemberConstraintSet<'tcx, ty::RegionVid> {
6868}
6969
7070impl < ' tcx > MemberConstraintSet < ' tcx , ty:: RegionVid > {
71+ /// Pushes a member constraint into the set.
72+ ///
73+ /// The input member constraint `m_c` is in the form produced by
74+ /// the the `rustc::infer` code.
75+ ///
76+ /// The `to_region_vid` callback fn is used to convert the regions
77+ /// within into `RegionVid` format -- it typically consults the
78+ /// `UniversalRegions` data structure that is known to the caller
79+ /// (but which this code is unaware of).
7180 crate fn push_constraint (
7281 & mut self ,
7382 m_c : & MemberConstraint < ' tcx > ,
@@ -93,14 +102,14 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
93102 }
94103}
95104
96- impl < ' tcx , R1 > MemberConstraintSet < ' tcx , R1 >
105+ impl < R1 > MemberConstraintSet < ' tcx , R1 >
97106where
98107 R1 : Copy + Hash + Eq ,
99108{
100109 /// Remap the "member region" key using `map_fn`, producing a new
101- /// pick- constraint set. This is used in the NLL code to map from
110+ /// member constraint set. This is used in the NLL code to map from
102111 /// the original `RegionVid` to an scc index. In some cases, we
103- /// may have multiple R1 values mapping to the same R2 key -- that
112+ /// may have multiple `R1` values mapping to the same `R2` key -- that
104113 /// is ok, the two sets will be merged.
105114 crate fn into_mapped < R2 > (
106115 self ,
@@ -112,12 +121,12 @@ where
112121 // We can re-use most of the original data, just tweaking the
113122 // linked list links a bit.
114123 //
115- // For example if we had two keys Ra and Rb that both now wind
116- // up mapped to the same key S , we would append the linked
117- // list for Ra onto the end of the linked list for Rb (or vice
118- // versa) -- this basically just requires rewriting the final
119- // link from one list to point at the othe other (see
120- // `append_list`).
124+ // For example if we had two keys `Ra` and `Rb` that both now
125+ // wind up mapped to the same key `S` , we would append the
126+ // linked list for `Ra` onto the end of the linked list for
127+ // `Rb` (or vice versa) -- this basically just requires
128+ // rewriting the final link from one list to point at the othe
129+ // other (see `append_list`).
121130
122131 let MemberConstraintSet { first_constraints, mut constraints, choice_regions } = self ;
123132
@@ -140,7 +149,7 @@ where
140149 }
141150}
142151
143- impl < ' tcx , R > MemberConstraintSet < ' tcx , R >
152+ impl < R > MemberConstraintSet < ' tcx , R >
144153where
145154 R : Copy + Hash + Eq ,
146155{
@@ -169,7 +178,7 @@ where
169178 }
170179
171180 /// Returns the "choice regions" for a given member
172- /// constraint. This is the R1..Rn from a constraint like:
181+ /// constraint. This is the ` R1..Rn` from a constraint like:
173182 ///
174183 /// ```
175184 /// R0 member of [R1..Rn]
0 commit comments