@@ -146,7 +146,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
146
146
/// returns an `InferOk` with subobligations that must be
147
147
/// processed.
148
148
pub fn process_registered_region_obligations (
149
- & self ,
149
+ & mut self ,
150
150
region_bound_pairs_map : & FxHashMap < hir:: HirId , RegionBoundPairs < ' tcx > > ,
151
151
implicit_region_bound : Option < ty:: Region < ' tcx > > ,
152
152
param_env : ty:: ParamEnv < ' tcx > ,
@@ -159,6 +159,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
159
159
debug ! ( "process_registered_region_obligations()" ) ;
160
160
161
161
let my_region_obligations = self . take_registered_region_obligations ( ) ;
162
+ let tcx = self . tcx ;
162
163
163
164
for ( body_id, RegionObligation { sup_type, sub_region, origin } ) in my_region_obligations {
164
165
debug ! (
@@ -170,15 +171,15 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
170
171
171
172
if let Some ( region_bound_pairs) = region_bound_pairs_map. get ( & body_id) {
172
173
let outlives = & mut TypeOutlives :: new (
173
- self ,
174
- self . tcx ,
174
+ & mut * self ,
175
+ tcx,
175
176
& region_bound_pairs,
176
177
implicit_region_bound,
177
178
param_env,
178
179
) ;
179
180
outlives. type_must_outlive ( origin, sup_type, sub_region) ;
180
181
} else {
181
- self . tcx . sess . delay_span_bug (
182
+ tcx. sess . delay_span_bug (
182
183
origin. span ( ) ,
183
184
& format ! ( "no region-bound-pairs for {:?}" , body_id) ,
184
185
)
@@ -189,22 +190,23 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
189
190
/// Processes a single ad-hoc region obligation that was not
190
191
/// registered in advance.
191
192
pub fn type_must_outlive (
192
- & self ,
193
+ & mut self ,
193
194
region_bound_pairs : & RegionBoundPairs < ' tcx > ,
194
195
implicit_region_bound : Option < ty:: Region < ' tcx > > ,
195
196
param_env : ty:: ParamEnv < ' tcx > ,
196
197
origin : infer:: SubregionOrigin < ' tcx > ,
197
198
ty : Ty < ' tcx > ,
198
199
region : ty:: Region < ' tcx > ,
199
200
) {
201
+ let tcx = self . tcx ;
202
+ let ty = self . resolve_vars_if_possible ( ty) ;
200
203
let outlives = & mut TypeOutlives :: new (
201
204
self ,
202
- self . tcx ,
205
+ tcx,
203
206
region_bound_pairs,
204
207
implicit_region_bound,
205
208
param_env,
206
209
) ;
207
- let ty = self . resolve_vars_if_possible ( ty) ;
208
210
outlives. type_must_outlive ( origin, ty, region) ;
209
211
}
210
212
}
@@ -460,7 +462,7 @@ where
460
462
}
461
463
}
462
464
463
- impl < ' cx , ' tcx > TypeOutlivesDelegate < ' tcx > for & ' cx InferCtxt < ' cx , ' tcx > {
465
+ impl < ' a , ' cx , ' tcx > TypeOutlivesDelegate < ' tcx > for & ' a mut InferCtxt < ' cx , ' tcx > {
464
466
fn push_sub_region_constraint (
465
467
& mut self ,
466
468
origin : SubregionOrigin < ' tcx > ,
0 commit comments