@@ -247,15 +247,15 @@ impl<'tcx> UniversalRegions<'tcx> {
247
247
tcx : TyCtxt < ' tcx > ,
248
248
closure_substs : SubstsRef < ' tcx > ,
249
249
expected_num_vars : usize ,
250
- closure_base_def_id : DefId ,
250
+ typeck_root_def_id : DefId ,
251
251
) -> IndexVec < RegionVid , ty:: Region < ' tcx > > {
252
252
let mut region_mapping = IndexVec :: with_capacity ( expected_num_vars) ;
253
253
region_mapping. push ( tcx. lifetimes . re_static ) ;
254
254
tcx. for_each_free_region ( & closure_substs, |fr| {
255
255
region_mapping. push ( fr) ;
256
256
} ) ;
257
257
258
- for_each_late_bound_region_defined_on ( tcx, closure_base_def_id , |r| {
258
+ for_each_late_bound_region_defined_on ( tcx, typeck_root_def_id , |r| {
259
259
region_mapping. push ( r) ;
260
260
} ) ;
261
261
@@ -349,8 +349,8 @@ impl<'tcx> UniversalRegions<'tcx> {
349
349
// tests, and the resulting print-outs include def-ids
350
350
// and other things that are not stable across tests!
351
351
// So we just include the region-vid. Annoying.
352
- let closure_base_def_id = tcx. closure_base_def_id ( def_id) ;
353
- for_each_late_bound_region_defined_on ( tcx, closure_base_def_id , |r| {
352
+ let typeck_root_def_id = tcx. typeck_root_def_id ( def_id) ;
353
+ for_each_late_bound_region_defined_on ( tcx, typeck_root_def_id , |r| {
354
354
err. note ( & format ! ( "late-bound region is {:?}" , self . to_region_vid( r) , ) ) ;
355
355
} ) ;
356
356
}
@@ -364,8 +364,8 @@ impl<'tcx> UniversalRegions<'tcx> {
364
364
// FIXME: As above, we'd like to print out the region
365
365
// `r` but doing so is not stable across architectures
366
366
// and so forth.
367
- let closure_base_def_id = tcx. closure_base_def_id ( def_id) ;
368
- for_each_late_bound_region_defined_on ( tcx, closure_base_def_id , |r| {
367
+ let typeck_root_def_id = tcx. typeck_root_def_id ( def_id) ;
368
+ for_each_late_bound_region_defined_on ( tcx, typeck_root_def_id , |r| {
369
369
err. note ( & format ! ( "late-bound region is {:?}" , self . to_region_vid( r) , ) ) ;
370
370
} ) ;
371
371
}
@@ -422,15 +422,15 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
422
422
let mut indices = self . compute_indices ( fr_static, defining_ty) ;
423
423
debug ! ( "build: indices={:?}" , indices) ;
424
424
425
- let closure_base_def_id = self . infcx . tcx . closure_base_def_id ( self . mir_def . did . to_def_id ( ) ) ;
425
+ let typeck_root_def_id = self . infcx . tcx . typeck_root_def_id ( self . mir_def . did . to_def_id ( ) ) ;
426
426
427
427
// If this is a closure or generator, then the late-bound regions from the enclosing
428
428
// function are actually external regions to us. For example, here, 'a is not local
429
429
// to the closure c (although it is local to the fn foo):
430
430
// fn foo<'a>() {
431
431
// let c = || { let x: &'a u32 = ...; }
432
432
// }
433
- if self . mir_def . did . to_def_id ( ) != closure_base_def_id {
433
+ if self . mir_def . did . to_def_id ( ) != typeck_root_def_id {
434
434
self . infcx
435
435
. replace_late_bound_regions_with_nll_infer_vars ( self . mir_def . did , & mut indices)
436
436
}
@@ -448,7 +448,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
448
448
) ;
449
449
// Converse of above, if this is a function then the late-bound regions declared on its
450
450
// signature are local to the fn.
451
- if self . mir_def . did . to_def_id ( ) == closure_base_def_id {
451
+ if self . mir_def . did . to_def_id ( ) == typeck_root_def_id {
452
452
self . infcx
453
453
. replace_late_bound_regions_with_nll_infer_vars ( self . mir_def . did , & mut indices) ;
454
454
}
@@ -513,12 +513,12 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
513
513
/// see `DefiningTy` for details.
514
514
fn defining_ty ( & self ) -> DefiningTy < ' tcx > {
515
515
let tcx = self . infcx . tcx ;
516
- let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def . did . to_def_id ( ) ) ;
516
+ let typeck_root_def_id = tcx. typeck_root_def_id ( self . mir_def . did . to_def_id ( ) ) ;
517
517
518
518
match tcx. hir ( ) . body_owner_kind ( self . mir_hir_id ) {
519
519
BodyOwnerKind :: Closure | BodyOwnerKind :: Fn => {
520
- let defining_ty = if self . mir_def . did . to_def_id ( ) == closure_base_def_id {
521
- tcx. type_of ( closure_base_def_id )
520
+ let defining_ty = if self . mir_def . did . to_def_id ( ) == typeck_root_def_id {
521
+ tcx. type_of ( typeck_root_def_id )
522
522
} else {
523
523
let tables = tcx. typeck ( self . mir_def . did ) ;
524
524
tables. node_type ( self . mir_hir_id )
@@ -545,8 +545,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
545
545
}
546
546
547
547
BodyOwnerKind :: Const | BodyOwnerKind :: Static ( ..) => {
548
- let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id ) ;
549
- if self . mir_def . did . to_def_id ( ) == closure_base_def_id {
548
+ let identity_substs = InternalSubsts :: identity_for_item ( tcx, typeck_root_def_id ) ;
549
+ if self . mir_def . did . to_def_id ( ) == typeck_root_def_id {
550
550
let substs =
551
551
self . infcx . replace_free_regions_with_nll_infer_vars ( FR , identity_substs) ;
552
552
DefiningTy :: Const ( self . mir_def . did . to_def_id ( ) , substs)
@@ -574,19 +574,19 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
574
574
defining_ty : DefiningTy < ' tcx > ,
575
575
) -> UniversalRegionIndices < ' tcx > {
576
576
let tcx = self . infcx . tcx ;
577
- let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def . did . to_def_id ( ) ) ;
578
- let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id ) ;
577
+ let typeck_root_def_id = tcx. typeck_root_def_id ( self . mir_def . did . to_def_id ( ) ) ;
578
+ let identity_substs = InternalSubsts :: identity_for_item ( tcx, typeck_root_def_id ) ;
579
579
let fr_substs = match defining_ty {
580
580
DefiningTy :: Closure ( _, ref substs)
581
581
| DefiningTy :: Generator ( _, ref substs, _)
582
582
| DefiningTy :: InlineConst ( _, ref substs) => {
583
583
// In the case of closures, we rely on the fact that
584
584
// the first N elements in the ClosureSubsts are
585
- // inherited from the `closure_base_def_id `.
585
+ // inherited from the `typeck_root_def_id `.
586
586
// Therefore, when we zip together (below) with
587
587
// `identity_substs`, we will get only those regions
588
588
// that correspond to early-bound regions declared on
589
- // the `closure_base_def_id `.
589
+ // the `typeck_root_def_id `.
590
590
assert ! ( substs. len( ) >= identity_substs. len( ) ) ;
591
591
assert_eq ! ( substs. regions( ) . count( ) , identity_substs. regions( ) . count( ) ) ;
592
592
substs
@@ -765,8 +765,8 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
765
765
indices : & mut UniversalRegionIndices < ' tcx > ,
766
766
) {
767
767
debug ! ( "replace_late_bound_regions_with_nll_infer_vars(mir_def_id={:?})" , mir_def_id) ;
768
- let closure_base_def_id = self . tcx . closure_base_def_id ( mir_def_id. to_def_id ( ) ) ;
769
- for_each_late_bound_region_defined_on ( self . tcx , closure_base_def_id , |r| {
768
+ let typeck_root_def_id = self . tcx . typeck_root_def_id ( mir_def_id. to_def_id ( ) ) ;
769
+ for_each_late_bound_region_defined_on ( self . tcx , typeck_root_def_id , |r| {
770
770
debug ! ( "replace_late_bound_regions_with_nll_infer_vars: r={:?}" , r) ;
771
771
if !indices. indices . contains_key ( & r) {
772
772
let region_vid = self . next_nll_region_var ( FR ) ;
0 commit comments