@@ -247,15 +247,15 @@ impl<'tcx> UniversalRegions<'tcx> {
247247 tcx : TyCtxt < ' tcx > ,
248248 closure_substs : SubstsRef < ' tcx > ,
249249 expected_num_vars : usize ,
250- closure_base_def_id : DefId ,
250+ typeck_root_def_id : DefId ,
251251 ) -> IndexVec < RegionVid , ty:: Region < ' tcx > > {
252252 let mut region_mapping = IndexVec :: with_capacity ( expected_num_vars) ;
253253 region_mapping. push ( tcx. lifetimes . re_static ) ;
254254 tcx. for_each_free_region ( & closure_substs, |fr| {
255255 region_mapping. push ( fr) ;
256256 } ) ;
257257
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| {
259259 region_mapping. push ( r) ;
260260 } ) ;
261261
@@ -349,8 +349,8 @@ impl<'tcx> UniversalRegions<'tcx> {
349349 // tests, and the resulting print-outs include def-ids
350350 // and other things that are not stable across tests!
351351 // 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| {
354354 err. note ( & format ! ( "late-bound region is {:?}" , self . to_region_vid( r) , ) ) ;
355355 } ) ;
356356 }
@@ -364,8 +364,8 @@ impl<'tcx> UniversalRegions<'tcx> {
364364 // FIXME: As above, we'd like to print out the region
365365 // `r` but doing so is not stable across architectures
366366 // 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| {
369369 err. note ( & format ! ( "late-bound region is {:?}" , self . to_region_vid( r) , ) ) ;
370370 } ) ;
371371 }
@@ -422,15 +422,15 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
422422 let mut indices = self . compute_indices ( fr_static, defining_ty) ;
423423 debug ! ( "build: indices={:?}" , indices) ;
424424
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 ( ) ) ;
426426
427427 // If this is a closure or generator, then the late-bound regions from the enclosing
428428 // function are actually external regions to us. For example, here, 'a is not local
429429 // to the closure c (although it is local to the fn foo):
430430 // fn foo<'a>() {
431431 // let c = || { let x: &'a u32 = ...; }
432432 // }
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 {
434434 self . infcx
435435 . replace_late_bound_regions_with_nll_infer_vars ( self . mir_def . did , & mut indices)
436436 }
@@ -448,7 +448,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
448448 ) ;
449449 // Converse of above, if this is a function then the late-bound regions declared on its
450450 // 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 {
452452 self . infcx
453453 . replace_late_bound_regions_with_nll_infer_vars ( self . mir_def . did , & mut indices) ;
454454 }
@@ -513,12 +513,12 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
513513 /// see `DefiningTy` for details.
514514 fn defining_ty ( & self ) -> DefiningTy < ' tcx > {
515515 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 ( ) ) ;
517517
518518 match tcx. hir ( ) . body_owner_kind ( self . mir_hir_id ) {
519519 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 )
522522 } else {
523523 let tables = tcx. typeck ( self . mir_def . did ) ;
524524 tables. node_type ( self . mir_hir_id )
@@ -545,8 +545,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
545545 }
546546
547547 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 {
550550 let substs =
551551 self . infcx . replace_free_regions_with_nll_infer_vars ( FR , identity_substs) ;
552552 DefiningTy :: Const ( self . mir_def . did . to_def_id ( ) , substs)
@@ -574,19 +574,19 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
574574 defining_ty : DefiningTy < ' tcx > ,
575575 ) -> UniversalRegionIndices < ' tcx > {
576576 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 ) ;
579579 let fr_substs = match defining_ty {
580580 DefiningTy :: Closure ( _, ref substs)
581581 | DefiningTy :: Generator ( _, ref substs, _)
582582 | DefiningTy :: InlineConst ( _, ref substs) => {
583583 // In the case of closures, we rely on the fact that
584584 // the first N elements in the ClosureSubsts are
585- // inherited from the `closure_base_def_id `.
585+ // inherited from the `typeck_root_def_id `.
586586 // Therefore, when we zip together (below) with
587587 // `identity_substs`, we will get only those regions
588588 // that correspond to early-bound regions declared on
589- // the `closure_base_def_id `.
589+ // the `typeck_root_def_id `.
590590 assert ! ( substs. len( ) >= identity_substs. len( ) ) ;
591591 assert_eq ! ( substs. regions( ) . count( ) , identity_substs. regions( ) . count( ) ) ;
592592 substs
@@ -765,8 +765,8 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
765765 indices : & mut UniversalRegionIndices < ' tcx > ,
766766 ) {
767767 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| {
770770 debug ! ( "replace_late_bound_regions_with_nll_infer_vars: r={:?}" , r) ;
771771 if !indices. indices . contains_key ( & r) {
772772 let region_vid = self . next_nll_region_var ( FR ) ;
0 commit comments