@@ -232,8 +232,7 @@ impl<'tcx> UniversalRegions<'tcx> {
232232 ) -> Self {
233233 let tcx = infcx. tcx ;
234234 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 ( )
237236 }
238237
239238 /// Given a reference to a closure type, extracts all the values
@@ -389,7 +388,7 @@ impl<'tcx> UniversalRegions<'tcx> {
389388
390389struct UniversalRegionsBuilder < ' cx , ' tcx > {
391390 infcx : & ' cx InferCtxt < ' cx , ' tcx > ,
392- mir_def_id : DefId ,
391+ mir_def_id : LocalDefId ,
393392 mir_hir_id : HirId ,
394393 param_env : ty:: ParamEnv < ' tcx > ,
395394}
@@ -418,15 +417,15 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
418417 let mut indices = self . compute_indices ( fr_static, defining_ty) ;
419418 debug ! ( "build: indices={:?}" , indices) ;
420419
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 ( ) ) ;
422421
423422 // If this is a closure or generator, then the late-bound regions from the enclosing
424423 // function are actually external regions to us. For example, here, 'a is not local
425424 // to the closure c (although it is local to the fn foo):
426425 // fn foo<'a>() {
427426 // let c = || { let x: &'a u32 = ...; }
428427 // }
429- if self . mir_def_id != closure_base_def_id {
428+ if self . mir_def_id . to_def_id ( ) != closure_base_def_id {
430429 self . infcx . replace_late_bound_regions_with_nll_infer_vars ( self . mir_def_id , & mut indices)
431430 }
432431
@@ -443,7 +442,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
443442 ) ;
444443 // Converse of above, if this is a function then the late-bound regions declared on its
445444 // 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 {
447446 self . infcx
448447 . replace_late_bound_regions_with_nll_infer_vars ( self . mir_def_id , & mut indices) ;
449448 }
@@ -508,14 +507,14 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
508507 /// see `DefiningTy` for details.
509508 fn defining_ty ( & self ) -> DefiningTy < ' tcx > {
510509 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 ( ) ) ;
512511
513512 match tcx. hir ( ) . body_owner_kind ( self . mir_hir_id ) {
514513 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 {
516515 tcx. type_of ( closure_base_def_id)
517516 } 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 ) ;
519518 tables. node_type ( self . mir_hir_id )
520519 } ;
521520
@@ -540,11 +539,11 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
540539 }
541540
542541 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 ) ;
544543 let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id) ;
545544 let substs =
546545 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)
548547 }
549548 }
550549 }
@@ -559,7 +558,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
559558 defining_ty : DefiningTy < ' tcx > ,
560559 ) -> UniversalRegionIndices < ' tcx > {
561560 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 ( ) ) ;
563562 let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id) ;
564563 let fr_substs = match defining_ty {
565564 DefiningTy :: Closure ( _, ref substs) | DefiningTy :: Generator ( _, ref substs, _) => {
@@ -593,7 +592,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
593592 let tcx = self . infcx . tcx ;
594593 match defining_ty {
595594 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) ;
597596 let closure_sig = substs. as_closure ( ) . sig ( ) ;
598597 let inputs_and_output = closure_sig. inputs_and_output ( ) ;
599598 let closure_ty = tcx. closure_env_ty ( def_id, substs) . unwrap ( ) ;
@@ -617,7 +616,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
617616 }
618617
619618 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) ;
621620 let resume_ty = substs. as_generator ( ) . resume_ty ( ) ;
622621 let output = substs. as_generator ( ) . return_ty ( ) ;
623622 let generator_ty = tcx. mk_generator ( def_id, substs, movability) ;
@@ -635,7 +634,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
635634 DefiningTy :: Const ( def_id, _) => {
636635 // For a constant body, there are no inputs, and one
637636 // "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) ;
639638 let ty = tcx. type_of ( def_id) ;
640639 let ty = indices. fold_to_region_vids ( tcx, & ty) ;
641640 ty:: Binder :: dummy ( tcx. intern_type_list ( & [ ty] ) )
@@ -656,7 +655,7 @@ trait InferCtxtExt<'tcx> {
656655 fn replace_bound_regions_with_nll_infer_vars < T > (
657656 & self ,
658657 origin : NLLRegionVariableOrigin ,
659- all_outlive_scope : DefId ,
658+ all_outlive_scope : LocalDefId ,
660659 value : & ty:: Binder < T > ,
661660 indices : & mut UniversalRegionIndices < ' tcx > ,
662661 ) -> T
@@ -665,7 +664,7 @@ trait InferCtxtExt<'tcx> {
665664
666665 fn replace_late_bound_regions_with_nll_infer_vars (
667666 & self ,
668- mir_def_id : DefId ,
667+ mir_def_id : LocalDefId ,
669668 indices : & mut UniversalRegionIndices < ' tcx > ,
670669 ) ;
671670}
@@ -685,7 +684,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
685684 fn replace_bound_regions_with_nll_infer_vars < T > (
686685 & self ,
687686 origin : NLLRegionVariableOrigin ,
688- all_outlive_scope : DefId ,
687+ all_outlive_scope : LocalDefId ,
689688 value : & ty:: Binder < T > ,
690689 indices : & mut UniversalRegionIndices < ' tcx > ,
691690 ) -> T
@@ -699,7 +698,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
699698 let ( value, _map) = self . tcx . replace_late_bound_regions ( value, |br| {
700699 debug ! ( "replace_bound_regions_with_nll_infer_vars: br={:?}" , br) ;
701700 let liberated_region = self . tcx . mk_region ( ty:: ReFree ( ty:: FreeRegion {
702- scope : all_outlive_scope,
701+ scope : all_outlive_scope. to_def_id ( ) ,
703702 bound_region : br,
704703 } ) ) ;
705704 let region_vid = self . next_nll_region_var ( origin) ;
@@ -724,11 +723,11 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
724723 /// inputs vector.
725724 fn replace_late_bound_regions_with_nll_infer_vars (
726725 & self ,
727- mir_def_id : DefId ,
726+ mir_def_id : LocalDefId ,
728727 indices : & mut UniversalRegionIndices < ' tcx > ,
729728 ) {
730729 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 ( ) ) ;
732731 for_each_late_bound_region_defined_on ( self . tcx , closure_base_def_id, |r| {
733732 debug ! ( "replace_late_bound_regions_with_nll_infer_vars: r={:?}" , r) ;
734733 if !indices. indices . contains_key ( & r) {
0 commit comments