@@ -8,18 +8,18 @@ use std::ops::Index;
8
8
use syntax_pos:: Span ;
9
9
10
10
/// Compactly stores a set of `R0 member of [R1...Rn]` constraints,
11
- /// indexed by the region R0 .
11
+ /// indexed by the region `R0` .
12
12
crate struct MemberConstraintSet < ' tcx , R >
13
13
where
14
14
R : Copy + Hash + Eq ,
15
15
{
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
17
17
/// index into the `constraints` vector below.
18
18
first_constraints : FxHashMap < R , NllMemberConstraintIndex > ,
19
19
20
20
/// Stores the data about each `R0 member of [R1..Rn]` constraint.
21
21
/// 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` .
23
23
constraints : IndexVec < NllMemberConstraintIndex , NllMemberConstraint < ' tcx > > ,
24
24
25
25
/// Stores the `R1..Rn` regions for *all* sets. For any given
@@ -38,10 +38,10 @@ crate struct NllMemberConstraint<'tcx> {
38
38
/// The span where the hidden type was instantiated.
39
39
crate definition_span : Span ,
40
40
41
- /// The hidden type in which R0 appears. (Used in error reporting.)
41
+ /// The hidden type in which `R0` appears. (Used in error reporting.)
42
42
crate hidden_ty : Ty < ' tcx > ,
43
43
44
- /// The region R0 .
44
+ /// The region `R0` .
45
45
crate member_region_vid : ty:: RegionVid ,
46
46
47
47
/// Index of `R1` in `choice_regions` vector from `MemberConstraintSet`.
@@ -68,6 +68,15 @@ impl Default for MemberConstraintSet<'tcx, ty::RegionVid> {
68
68
}
69
69
70
70
impl < ' 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).
71
80
crate fn push_constraint (
72
81
& mut self ,
73
82
m_c : & MemberConstraint < ' tcx > ,
@@ -93,14 +102,14 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
93
102
}
94
103
}
95
104
96
- impl < ' tcx , R1 > MemberConstraintSet < ' tcx , R1 >
105
+ impl < R1 > MemberConstraintSet < ' tcx , R1 >
97
106
where
98
107
R1 : Copy + Hash + Eq ,
99
108
{
100
109
/// 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
102
111
/// 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
104
113
/// is ok, the two sets will be merged.
105
114
crate fn into_mapped < R2 > (
106
115
self ,
@@ -112,12 +121,12 @@ where
112
121
// We can re-use most of the original data, just tweaking the
113
122
// linked list links a bit.
114
123
//
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`).
121
130
122
131
let MemberConstraintSet { first_constraints, mut constraints, choice_regions } = self ;
123
132
@@ -140,7 +149,7 @@ where
140
149
}
141
150
}
142
151
143
- impl < ' tcx , R > MemberConstraintSet < ' tcx , R >
152
+ impl < R > MemberConstraintSet < ' tcx , R >
144
153
where
145
154
R : Copy + Hash + Eq ,
146
155
{
@@ -169,7 +178,7 @@ where
169
178
}
170
179
171
180
/// 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:
173
182
///
174
183
/// ```
175
184
/// R0 member of [R1..Rn]
0 commit comments