@@ -88,34 +88,35 @@ pub struct ConstQualifs {
8888/// requirements are then verified and proved by the closure's
8989/// creating function. This struct encodes those requirements.
9090///
91- /// The requirements are listed as being between various
92- /// `RegionVid`. The 0th region refers to `'static`; subsequent region
93- /// vids refer to the free regions that appear in the closure (or
94- /// generator's) type, in order of appearance. (This numbering is
95- /// actually defined by the `UniversalRegions` struct in the NLL
96- /// region checker. See for example
97- /// `UniversalRegions::closure_mapping`.) Note that we treat the free
98- /// regions in the closure's type "as if" they were erased, so their
99- /// precise identity is not important, only their position.
91+ /// The requirements are listed as being between various `RegionVid`. The 0th
92+ /// region refers to `'static`; subsequent region vids refer to the free
93+ /// regions that appear in the closure (or generator's) type, in order of
94+ /// appearance. (This numbering is actually defined by the `UniversalRegions`
95+ /// struct in the NLL region checker. See for example
96+ /// `UniversalRegions::closure_mapping`.) Note the free regions in the
97+ /// closure's signature and captures are erased.
10098///
10199/// Example: If type check produces a closure with the closure substs:
102100///
103101/// ```text
104102/// ClosureSubsts = [
105- /// i8, // the "closure kind"
106- /// for<'x> fn(&'a &'x u32) -> &'x u32, // the "closure signature"
107- /// &'a String, // some upvar
103+ /// 'a, // From the parent.
104+ /// 'b,
105+ /// i8, // the "closure kind"
106+ /// for<'x> fn(&'<erased> &'x u32) -> &'x u32, // the "closure signature"
107+ /// &'<erased> String, // some upvar
108108/// ]
109109/// ```
110110///
111- /// here, there is one unique free region (`'a`) but it appears
112- /// twice. We would "renumber" each occurrence to a unique vid, as follows:
111+ /// We would "renumber" each free region to a unique vid, as follows:
113112///
114113/// ```text
115114/// ClosureSubsts = [
116- /// i8, // the "closure kind"
117- /// for<'x> fn(&'1 &'x u32) -> &'x u32, // the "closure signature"
118- /// &'2 String, // some upvar
115+ /// '1, // From the parent.
116+ /// '2,
117+ /// i8, // the "closure kind"
118+ /// for<'x> fn(&'3 &'x u32) -> &'x u32, // the "closure signature"
119+ /// &'4 String, // some upvar
119120/// ]
120121/// ```
121122///
@@ -124,14 +125,12 @@ pub struct ConstQualifs {
124125/// can be extracted from its type and constrained to have the given
125126/// outlives relationship.
126127///
127- /// In some cases, we have to record outlives requirements between
128- /// types and regions as well. In that case, if those types include
129- /// any regions, those regions are recorded as `ReClosureBound`
130- /// instances assigned one of these same indices. Those regions will
131- /// be substituted away by the creator. We use `ReClosureBound` in
132- /// that case because the regions must be allocated in the global
133- /// `TyCtxt`, and hence we cannot use `ReVar` (which is what we use
134- /// internally within the rest of the NLL code).
128+ /// In some cases, we have to record outlives requirements between types and
129+ /// regions as well. In that case, if those types include any regions, those
130+ /// regions are recorded using their external names (`ReStatic`,
131+ /// `ReEarlyBound`, `ReFree`). We use these because in a query response we
132+ /// cannot use `ReVar` (which is what we use internally within the rest of the
133+ /// NLL code).
135134#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
136135pub struct ClosureRegionRequirements < ' tcx > {
137136 /// The number of external regions defined on the closure. In our
0 commit comments