@@ -146,7 +146,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
146146 /// returns an `InferOk` with subobligations that must be
147147 /// processed.
148148 pub fn process_registered_region_obligations (
149- & self ,
149+ & mut self ,
150150 region_bound_pairs_map : & FxHashMap < hir:: HirId , RegionBoundPairs < ' tcx > > ,
151151 implicit_region_bound : Option < ty:: Region < ' tcx > > ,
152152 param_env : ty:: ParamEnv < ' tcx > ,
@@ -159,6 +159,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
159159 debug ! ( "process_registered_region_obligations()" ) ;
160160
161161 let my_region_obligations = self . take_registered_region_obligations ( ) ;
162+ let tcx = self . tcx ;
162163
163164 for ( body_id, RegionObligation { sup_type, sub_region, origin } ) in my_region_obligations {
164165 debug ! (
@@ -170,15 +171,15 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
170171
171172 if let Some ( region_bound_pairs) = region_bound_pairs_map. get ( & body_id) {
172173 let outlives = & mut TypeOutlives :: new (
173- self ,
174- self . tcx ,
174+ & mut * self ,
175+ tcx,
175176 & region_bound_pairs,
176177 implicit_region_bound,
177178 param_env,
178179 ) ;
179180 outlives. type_must_outlive ( origin, sup_type, sub_region) ;
180181 } else {
181- self . tcx . sess . delay_span_bug (
182+ tcx. sess . delay_span_bug (
182183 origin. span ( ) ,
183184 & format ! ( "no region-bound-pairs for {:?}" , body_id) ,
184185 )
@@ -189,22 +190,23 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
189190 /// Processes a single ad-hoc region obligation that was not
190191 /// registered in advance.
191192 pub fn type_must_outlive (
192- & self ,
193+ & mut self ,
193194 region_bound_pairs : & RegionBoundPairs < ' tcx > ,
194195 implicit_region_bound : Option < ty:: Region < ' tcx > > ,
195196 param_env : ty:: ParamEnv < ' tcx > ,
196197 origin : infer:: SubregionOrigin < ' tcx > ,
197198 ty : Ty < ' tcx > ,
198199 region : ty:: Region < ' tcx > ,
199200 ) {
201+ let tcx = self . tcx ;
202+ let ty = self . resolve_vars_if_possible ( ty) ;
200203 let outlives = & mut TypeOutlives :: new (
201204 self ,
202- self . tcx ,
205+ tcx,
203206 region_bound_pairs,
204207 implicit_region_bound,
205208 param_env,
206209 ) ;
207- let ty = self . resolve_vars_if_possible ( ty) ;
208210 outlives. type_must_outlive ( origin, ty, region) ;
209211 }
210212}
@@ -460,7 +462,7 @@ where
460462 }
461463}
462464
463- impl < ' cx , ' tcx > TypeOutlivesDelegate < ' tcx > for & ' cx InferCtxt < ' cx , ' tcx > {
465+ impl < ' a , ' cx , ' tcx > TypeOutlivesDelegate < ' tcx > for & ' a mut InferCtxt < ' cx , ' tcx > {
464466 fn push_sub_region_constraint (
465467 & mut self ,
466468 origin : SubregionOrigin < ' tcx > ,
0 commit comments