@@ -111,7 +111,7 @@ fn mir_borrowck<'tcx>(
111
111
let opt_closure_req = tcx. infer_ctxt ( ) . enter ( |infcx| {
112
112
let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
113
113
let promoted: & IndexVec < _ , _ > = & promoted. borrow ( ) ;
114
- do_mir_borrowck ( & infcx, input_body, promoted, def )
114
+ do_mir_borrowck ( & infcx, input_body, promoted)
115
115
} ) ;
116
116
debug ! ( "mir_borrowck done" ) ;
117
117
@@ -122,8 +122,9 @@ fn do_mir_borrowck<'a, 'tcx>(
122
122
infcx : & InferCtxt < ' a , ' tcx > ,
123
123
input_body : & Body < ' tcx > ,
124
124
input_promoted : & IndexVec < Promoted , Body < ' tcx > > ,
125
- def : ty:: WithOptConstParam < LocalDefId > ,
126
125
) -> BorrowCheckResult < ' tcx > {
126
+ let def = input_body. source . with_opt_param ( ) . as_local ( ) . unwrap ( ) ;
127
+
127
128
debug ! ( "do_mir_borrowck(def = {:?})" , def) ;
128
129
129
130
let tcx = infcx. tcx ;
@@ -185,7 +186,7 @@ fn do_mir_borrowck<'a, 'tcx>(
185
186
// will have a lifetime tied to the inference context.
186
187
let mut body = input_body. clone ( ) ;
187
188
let mut promoted = input_promoted. clone ( ) ;
188
- let free_regions = nll:: replace_regions_in_mir ( infcx, def , param_env, & mut body, & mut promoted) ;
189
+ let free_regions = nll:: replace_regions_in_mir ( infcx, param_env, & mut body, & mut promoted) ;
189
190
let body = & body; // no further changes
190
191
191
192
let location_table = & LocationTable :: new ( & body) ;
@@ -203,7 +204,7 @@ fn do_mir_borrowck<'a, 'tcx>(
203
204
let mdpe = MoveDataParamEnv { move_data, param_env } ;
204
205
205
206
let mut flow_inits = MaybeInitializedPlaces :: new ( tcx, & body, & mdpe)
206
- . into_engine ( tcx, & body, def . did . to_def_id ( ) )
207
+ . into_engine ( tcx, & body)
207
208
. pass_name ( "borrowck" )
208
209
. iterate_to_fixpoint ( )
209
210
. into_results_cursor ( & body) ;
@@ -221,7 +222,6 @@ fn do_mir_borrowck<'a, 'tcx>(
221
222
nll_errors,
222
223
} = nll:: compute_regions (
223
224
infcx,
224
- def. did ,
225
225
free_regions,
226
226
body,
227
227
& promoted,
@@ -242,7 +242,6 @@ fn do_mir_borrowck<'a, 'tcx>(
242
242
nll:: dump_annotation (
243
243
infcx,
244
244
& body,
245
- def. did . to_def_id ( ) ,
246
245
& regioncx,
247
246
& opt_closure_req,
248
247
& opaque_type_values,
@@ -257,15 +256,15 @@ fn do_mir_borrowck<'a, 'tcx>(
257
256
let regioncx = Rc :: new ( regioncx) ;
258
257
259
258
let flow_borrows = Borrows :: new ( tcx, & body, regioncx. clone ( ) , & borrow_set)
260
- . into_engine ( tcx, & body, def . did . to_def_id ( ) )
259
+ . into_engine ( tcx, & body)
261
260
. pass_name ( "borrowck" )
262
261
. iterate_to_fixpoint ( ) ;
263
262
let flow_uninits = MaybeUninitializedPlaces :: new ( tcx, & body, & mdpe)
264
- . into_engine ( tcx, & body, def . did . to_def_id ( ) )
263
+ . into_engine ( tcx, & body)
265
264
. pass_name ( "borrowck" )
266
265
. iterate_to_fixpoint ( ) ;
267
266
let flow_ever_inits = EverInitializedPlaces :: new ( tcx, & body, & mdpe)
268
- . into_engine ( tcx, & body, def . did . to_def_id ( ) )
267
+ . into_engine ( tcx, & body)
269
268
. pass_name ( "borrowck" )
270
269
. iterate_to_fixpoint ( ) ;
271
270
@@ -286,7 +285,6 @@ fn do_mir_borrowck<'a, 'tcx>(
286
285
infcx,
287
286
param_env,
288
287
body : promoted_body,
289
- mir_def_id : def. did ,
290
288
move_data : & move_data,
291
289
location_table : & LocationTable :: new ( promoted_body) ,
292
290
movable_generator,
@@ -320,7 +318,6 @@ fn do_mir_borrowck<'a, 'tcx>(
320
318
infcx,
321
319
param_env,
322
320
body,
323
- mir_def_id : def. did ,
324
321
move_data : & mdpe. move_data ,
325
322
location_table,
326
323
movable_generator,
@@ -474,7 +471,6 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
474
471
crate infcx : & ' cx InferCtxt < ' cx , ' tcx > ,
475
472
param_env : ParamEnv < ' tcx > ,
476
473
body : & ' cx Body < ' tcx > ,
477
- mir_def_id : LocalDefId ,
478
474
move_data : & ' cx MoveData < ' tcx > ,
479
475
480
476
/// Map from MIR `Location` to `LocationIndex`; created
0 commit comments