@@ -21,7 +21,6 @@ use crate::{ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategor
2121
2222pub ( crate ) struct ConstraintConversion < ' a , ' tcx > {
2323 infcx : & ' a InferCtxt < ' tcx > ,
24- tcx : TyCtxt < ' tcx > ,
2524 universal_regions : & ' a UniversalRegions < ' tcx > ,
2625 /// Each RBP `GK: 'a` is assumed to be true. These encode
2726 /// relationships like `T: 'a` that are added via implicit bounds
@@ -34,7 +33,6 @@ pub(crate) struct ConstraintConversion<'a, 'tcx> {
3433 /// logic expecting to see (e.g.) `ReStatic`, and if we supplied
3534 /// our special inference variable there, we would mess that up.
3635 region_bound_pairs : & ' a RegionBoundPairs < ' tcx > ,
37- implicit_region_bound : ty:: Region < ' tcx > ,
3836 param_env : ty:: ParamEnv < ' tcx > ,
3937 known_type_outlives_obligations : & ' a [ ty:: PolyTypeOutlivesPredicate < ' tcx > ] ,
4038 locations : Locations ,
@@ -49,7 +47,6 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
4947 infcx : & ' a InferCtxt < ' tcx > ,
5048 universal_regions : & ' a UniversalRegions < ' tcx > ,
5149 region_bound_pairs : & ' a RegionBoundPairs < ' tcx > ,
52- implicit_region_bound : ty:: Region < ' tcx > ,
5350 param_env : ty:: ParamEnv < ' tcx > ,
5451 known_type_outlives_obligations : & ' a [ ty:: PolyTypeOutlivesPredicate < ' tcx > ] ,
5552 locations : Locations ,
@@ -59,10 +56,8 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
5956 ) -> Self {
6057 Self {
6158 infcx,
62- tcx : infcx. tcx ,
6359 universal_regions,
6460 region_bound_pairs,
65- implicit_region_bound,
6661 param_env,
6762 known_type_outlives_obligations,
6863 locations,
@@ -96,7 +91,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
9691 // into a vector. These are the regions that we will be
9792 // relating to one another.
9893 let closure_mapping = & UniversalRegions :: closure_mapping (
99- self . tcx ,
94+ self . infcx . tcx ,
10095 closure_args,
10196 closure_requirements. num_external_vids ,
10297 closure_def_id,
@@ -111,7 +106,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
111106 let subject = match outlives_requirement. subject {
112107 ClosureOutlivesSubject :: Region ( re) => closure_mapping[ re] . into ( ) ,
113108 ClosureOutlivesSubject :: Ty ( subject_ty) => {
114- subject_ty. instantiate ( self . tcx , |vid| closure_mapping[ vid] ) . into ( )
109+ subject_ty. instantiate ( self . infcx . tcx , |vid| closure_mapping[ vid] ) . into ( )
115110 }
116111 } ;
117112
@@ -127,14 +122,14 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
127122 predicate : ty:: OutlivesPredicate < ' tcx , ty:: GenericArg < ' tcx > > ,
128123 constraint_category : ConstraintCategory < ' tcx > ,
129124 ) {
125+ let tcx = self . infcx . tcx ;
130126 debug ! ( "generate: constraints at: {:#?}" , self . locations) ;
131127
132128 // Extract out various useful fields we'll need below.
133129 let ConstraintConversion {
134- tcx,
135130 infcx,
131+ universal_regions,
136132 region_bound_pairs,
137- implicit_region_bound,
138133 known_type_outlives_obligations,
139134 ..
140135 } = * self ;
@@ -145,7 +140,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
145140 break ;
146141 }
147142
148- if !self . tcx . recursion_limit ( ) . value_within_limit ( iteration) {
143+ if !tcx. recursion_limit ( ) . value_within_limit ( iteration) {
149144 bug ! (
150145 "FIXME(-Znext-solver): Overflowed when processing region obligations: {outlives_predicates:#?}"
151146 ) ;
@@ -170,10 +165,11 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
170165 ) ;
171166 }
172167
168+ let implicit_region_bound =
169+ ty:: Region :: new_var ( tcx, universal_regions. implicit_region_bound ( ) ) ;
173170 // we don't actually use this for anything, but
174171 // the `TypeOutlives` code needs an origin.
175172 let origin = infer:: RelateParamBound ( self . span , t1, None ) ;
176-
177173 TypeOutlives :: new (
178174 & mut * self ,
179175 tcx,
@@ -205,7 +201,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
205201 /// are dealt with during trait solving.
206202 fn replace_placeholders_with_nll < T : TypeFoldable < TyCtxt < ' tcx > > > ( & mut self , value : T ) -> T {
207203 if value. has_placeholders ( ) {
208- fold_regions ( self . tcx , value, |r, _| match r. kind ( ) {
204+ fold_regions ( self . infcx . tcx , value, |r, _| match r. kind ( ) {
209205 ty:: RePlaceholder ( placeholder) => {
210206 self . constraints . placeholder_region ( self . infcx , placeholder)
211207 }
0 commit comments