@@ -232,8 +232,7 @@ impl<'tcx> UniversalRegions<'tcx> {
232
232
) -> Self {
233
233
let tcx = infcx. tcx ;
234
234
let mir_hir_id = tcx. hir ( ) . as_local_hir_id ( mir_def_id) ;
235
- UniversalRegionsBuilder { infcx, mir_def_id : mir_def_id. to_def_id ( ) , mir_hir_id, param_env }
236
- . build ( )
235
+ UniversalRegionsBuilder { infcx, mir_def_id, mir_hir_id, param_env } . build ( )
237
236
}
238
237
239
238
/// Given a reference to a closure type, extracts all the values
@@ -389,7 +388,7 @@ impl<'tcx> UniversalRegions<'tcx> {
389
388
390
389
struct UniversalRegionsBuilder < ' cx , ' tcx > {
391
390
infcx : & ' cx InferCtxt < ' cx , ' tcx > ,
392
- mir_def_id : DefId ,
391
+ mir_def_id : LocalDefId ,
393
392
mir_hir_id : HirId ,
394
393
param_env : ty:: ParamEnv < ' tcx > ,
395
394
}
@@ -418,15 +417,15 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
418
417
let mut indices = self . compute_indices ( fr_static, defining_ty) ;
419
418
debug ! ( "build: indices={:?}" , indices) ;
420
419
421
- let closure_base_def_id = self . infcx . tcx . closure_base_def_id ( self . mir_def_id ) ;
420
+ let closure_base_def_id = self . infcx . tcx . closure_base_def_id ( self . mir_def_id . to_def_id ( ) ) ;
422
421
423
422
// If this is a closure or generator, then the late-bound regions from the enclosing
424
423
// function are actually external regions to us. For example, here, 'a is not local
425
424
// to the closure c (although it is local to the fn foo):
426
425
// fn foo<'a>() {
427
426
// let c = || { let x: &'a u32 = ...; }
428
427
// }
429
- if self . mir_def_id != closure_base_def_id {
428
+ if self . mir_def_id . to_def_id ( ) != closure_base_def_id {
430
429
self . infcx . replace_late_bound_regions_with_nll_infer_vars ( self . mir_def_id , & mut indices)
431
430
}
432
431
@@ -443,7 +442,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
443
442
) ;
444
443
// Converse of above, if this is a function then the late-bound regions declared on its
445
444
// signature are local to the fn.
446
- if self . mir_def_id == closure_base_def_id {
445
+ if self . mir_def_id . to_def_id ( ) == closure_base_def_id {
447
446
self . infcx
448
447
. replace_late_bound_regions_with_nll_infer_vars ( self . mir_def_id , & mut indices) ;
449
448
}
@@ -508,14 +507,14 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
508
507
/// see `DefiningTy` for details.
509
508
fn defining_ty ( & self ) -> DefiningTy < ' tcx > {
510
509
let tcx = self . infcx . tcx ;
511
- let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def_id ) ;
510
+ let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def_id . to_def_id ( ) ) ;
512
511
513
512
match tcx. hir ( ) . body_owner_kind ( self . mir_hir_id ) {
514
513
BodyOwnerKind :: Closure | BodyOwnerKind :: Fn => {
515
- let defining_ty = if self . mir_def_id == closure_base_def_id {
514
+ let defining_ty = if self . mir_def_id . to_def_id ( ) == closure_base_def_id {
516
515
tcx. type_of ( closure_base_def_id)
517
516
} else {
518
- let tables = tcx. typeck_tables_of ( self . mir_def_id . expect_local ( ) ) ;
517
+ let tables = tcx. typeck_tables_of ( self . mir_def_id ) ;
519
518
tables. node_type ( self . mir_hir_id )
520
519
} ;
521
520
@@ -540,11 +539,11 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
540
539
}
541
540
542
541
BodyOwnerKind :: Const | BodyOwnerKind :: Static ( ..) => {
543
- assert_eq ! ( closure_base_def_id , self . mir_def_id) ;
542
+ assert_eq ! ( self . mir_def_id. to_def_id ( ) , closure_base_def_id ) ;
544
543
let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id) ;
545
544
let substs =
546
545
self . infcx . replace_free_regions_with_nll_infer_vars ( FR , & identity_substs) ;
547
- DefiningTy :: Const ( self . mir_def_id , substs)
546
+ DefiningTy :: Const ( self . mir_def_id . to_def_id ( ) , substs)
548
547
}
549
548
}
550
549
}
@@ -559,7 +558,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
559
558
defining_ty : DefiningTy < ' tcx > ,
560
559
) -> UniversalRegionIndices < ' tcx > {
561
560
let tcx = self . infcx . tcx ;
562
- let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def_id ) ;
561
+ let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def_id . to_def_id ( ) ) ;
563
562
let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id) ;
564
563
let fr_substs = match defining_ty {
565
564
DefiningTy :: Closure ( _, ref substs) | DefiningTy :: Generator ( _, ref substs, _) => {
@@ -593,7 +592,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
593
592
let tcx = self . infcx . tcx ;
594
593
match defining_ty {
595
594
DefiningTy :: Closure ( def_id, substs) => {
596
- assert_eq ! ( self . mir_def_id, def_id) ;
595
+ assert_eq ! ( self . mir_def_id. to_def_id ( ) , def_id) ;
597
596
let closure_sig = substs. as_closure ( ) . sig ( ) ;
598
597
let inputs_and_output = closure_sig. inputs_and_output ( ) ;
599
598
let closure_ty = tcx. closure_env_ty ( def_id, substs) . unwrap ( ) ;
@@ -617,7 +616,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
617
616
}
618
617
619
618
DefiningTy :: Generator ( def_id, substs, movability) => {
620
- assert_eq ! ( self . mir_def_id, def_id) ;
619
+ assert_eq ! ( self . mir_def_id. to_def_id ( ) , def_id) ;
621
620
let resume_ty = substs. as_generator ( ) . resume_ty ( ) ;
622
621
let output = substs. as_generator ( ) . return_ty ( ) ;
623
622
let generator_ty = tcx. mk_generator ( def_id, substs, movability) ;
@@ -635,7 +634,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
635
634
DefiningTy :: Const ( def_id, _) => {
636
635
// For a constant body, there are no inputs, and one
637
636
// "output" (the type of the constant).
638
- assert_eq ! ( self . mir_def_id, def_id) ;
637
+ assert_eq ! ( self . mir_def_id. to_def_id ( ) , def_id) ;
639
638
let ty = tcx. type_of ( def_id) ;
640
639
let ty = indices. fold_to_region_vids ( tcx, & ty) ;
641
640
ty:: Binder :: dummy ( tcx. intern_type_list ( & [ ty] ) )
@@ -656,7 +655,7 @@ trait InferCtxtExt<'tcx> {
656
655
fn replace_bound_regions_with_nll_infer_vars < T > (
657
656
& self ,
658
657
origin : NLLRegionVariableOrigin ,
659
- all_outlive_scope : DefId ,
658
+ all_outlive_scope : LocalDefId ,
660
659
value : & ty:: Binder < T > ,
661
660
indices : & mut UniversalRegionIndices < ' tcx > ,
662
661
) -> T
@@ -665,7 +664,7 @@ trait InferCtxtExt<'tcx> {
665
664
666
665
fn replace_late_bound_regions_with_nll_infer_vars (
667
666
& self ,
668
- mir_def_id : DefId ,
667
+ mir_def_id : LocalDefId ,
669
668
indices : & mut UniversalRegionIndices < ' tcx > ,
670
669
) ;
671
670
}
@@ -685,7 +684,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
685
684
fn replace_bound_regions_with_nll_infer_vars < T > (
686
685
& self ,
687
686
origin : NLLRegionVariableOrigin ,
688
- all_outlive_scope : DefId ,
687
+ all_outlive_scope : LocalDefId ,
689
688
value : & ty:: Binder < T > ,
690
689
indices : & mut UniversalRegionIndices < ' tcx > ,
691
690
) -> T
@@ -699,7 +698,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
699
698
let ( value, _map) = self . tcx . replace_late_bound_regions ( value, |br| {
700
699
debug ! ( "replace_bound_regions_with_nll_infer_vars: br={:?}" , br) ;
701
700
let liberated_region = self . tcx . mk_region ( ty:: ReFree ( ty:: FreeRegion {
702
- scope : all_outlive_scope,
701
+ scope : all_outlive_scope. to_def_id ( ) ,
703
702
bound_region : br,
704
703
} ) ) ;
705
704
let region_vid = self . next_nll_region_var ( origin) ;
@@ -724,11 +723,11 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
724
723
/// inputs vector.
725
724
fn replace_late_bound_regions_with_nll_infer_vars (
726
725
& self ,
727
- mir_def_id : DefId ,
726
+ mir_def_id : LocalDefId ,
728
727
indices : & mut UniversalRegionIndices < ' tcx > ,
729
728
) {
730
729
debug ! ( "replace_late_bound_regions_with_nll_infer_vars(mir_def_id={:?})" , mir_def_id) ;
731
- let closure_base_def_id = self . tcx . closure_base_def_id ( mir_def_id) ;
730
+ let closure_base_def_id = self . tcx . closure_base_def_id ( mir_def_id. to_def_id ( ) ) ;
732
731
for_each_late_bound_region_defined_on ( self . tcx , closure_base_def_id, |r| {
733
732
debug ! ( "replace_late_bound_regions_with_nll_infer_vars: r={:?}" , r) ;
734
733
if !indices. indices . contains_key ( & r) {
0 commit comments