2222//! The code in this file doesn't *do anything* with those results; it
2323//! just returns them for other code to use.
2424
25- use rustc:: hir:: { self , BodyOwnerKind , HirId } ;
2625use rustc:: hir:: def_id:: DefId ;
27- use rustc:: infer:: { InferCtxt , NLLRegionVariableOrigin } ;
28- use rustc:: infer:: region_constraints:: GenericKind ;
26+ use rustc:: hir:: { self , BodyOwnerKind , HirId } ;
2927use rustc:: infer:: outlives:: bounds:: { self , OutlivesBound } ;
3028use rustc:: infer:: outlives:: free_region_map:: FreeRegionRelations ;
31- use rustc:: ty:: { self , RegionVid , Ty , TyCtxt , ClosureSubsts , GeneratorSubsts } ;
29+ use rustc:: infer:: region_constraints:: GenericKind ;
30+ use rustc:: infer:: { InferCtxt , NLLRegionVariableOrigin } ;
3231use rustc:: ty:: fold:: TypeFoldable ;
3332use rustc:: ty:: subst:: Substs ;
33+ use rustc:: ty:: { self , ClosureSubsts , GeneratorSubsts , RegionVid , Ty , TyCtxt } ;
3434use rustc:: util:: nodemap:: FxHashMap ;
3535use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
3636use rustc_data_structures:: transitive_relation:: TransitiveRelation ;
@@ -493,18 +493,15 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
493493
494494 debug ! (
495495 "build: global regions = {}..{}" ,
496- FIRST_GLOBAL_INDEX ,
497- first_extern_index
496+ FIRST_GLOBAL_INDEX , first_extern_index
498497 ) ;
499498 debug ! (
500499 "build: extern regions = {}..{}" ,
501- first_extern_index,
502- first_local_index
500+ first_extern_index, first_local_index
503501 ) ;
504502 debug ! (
505503 "build: local regions = {}..{}" ,
506- first_local_index,
507- num_universals
504+ first_local_index, num_universals
508505 ) ;
509506
510507 let yield_ty = match defining_ty {
@@ -548,7 +545,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
548545 let defining_ty = self . infcx
549546 . replace_free_regions_with_nll_infer_vars ( FR , & defining_ty) ;
550547
551- match defining_ty. sty {
548+ match defining_ty. sty {
552549 ty:: TyClosure ( def_id, substs) => DefiningTy :: Closure ( def_id, substs) ,
553550 ty:: TyGenerator ( def_id, substs, movability) => {
554551 DefiningTy :: Generator ( def_id, substs, movability)
@@ -587,8 +584,8 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
587584 let closure_base_def_id = tcx. closure_base_def_id ( self . mir_def_id ) ;
588585 let identity_substs = Substs :: identity_for_item ( gcx, closure_base_def_id) ;
589586 let fr_substs = match defining_ty {
590- DefiningTy :: Closure ( _, ClosureSubsts { ref substs } ) |
591- DefiningTy :: Generator ( _, GeneratorSubsts { ref substs } , _) => {
587+ DefiningTy :: Closure ( _, ClosureSubsts { ref substs } )
588+ | DefiningTy :: Generator ( _, GeneratorSubsts { ref substs } , _) => {
592589 // In the case of closures, we rely on the fact that
593590 // the first N elements in the ClosureSubsts are
594591 // inherited from the `closure_base_def_id`.
@@ -726,8 +723,7 @@ impl UniversalRegionRelations {
726723 fn relate_universal_regions ( & mut self , fr_a : RegionVid , fr_b : RegionVid ) {
727724 debug ! (
728725 "relate_universal_regions: fr_a={:?} outlives fr_b={:?}" ,
729- fr_a,
730- fr_b
726+ fr_a, fr_b
731727 ) ;
732728 self . outlives . add ( fr_a, fr_b) ;
733729 self . inverse_outlives . add ( fr_b, fr_a) ;
@@ -780,8 +776,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'gcx, 'tcx> {
780776 {
781777 debug ! (
782778 "replace_bound_regions_with_nll_infer_vars(value={:?}, all_outlive_scope={:?})" ,
783- value,
784- all_outlive_scope,
779+ value, all_outlive_scope,
785780 ) ;
786781 let ( value, _map) = self . tcx . replace_late_bound_regions ( value, |br| {
787782 let liberated_region = self . tcx . mk_region ( ty:: ReFree ( ty:: FreeRegion {
@@ -790,7 +785,10 @@ impl<'cx, 'gcx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'gcx, 'tcx> {
790785 } ) ) ;
791786 let region_vid = self . next_nll_region_var ( origin) ;
792787 indices. insert_late_bound_region ( liberated_region, region_vid. to_region_vid ( ) ) ;
793- debug ! ( "liberated_region={:?} => {:?}" , liberated_region, region_vid) ;
788+ debug ! (
789+ "liberated_region={:?} => {:?}" ,
790+ liberated_region, region_vid
791+ ) ;
794792 region_vid
795793 } ) ;
796794 value
@@ -803,9 +801,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
803801 /// in later and instantiate the late-bound regions, and then we
804802 /// insert the `ReFree` version of those into the map as
805803 /// well. These are used for error reporting.
806- fn insert_late_bound_region ( & mut self , r : ty:: Region < ' tcx > ,
807- vid : ty:: RegionVid )
808- {
804+ fn insert_late_bound_region ( & mut self , r : ty:: Region < ' tcx > , vid : ty:: RegionVid ) {
809805 self . indices . insert ( r, vid) ;
810806 }
811807
@@ -821,9 +817,9 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
821817 if let ty:: ReVar ( ..) = r {
822818 r. to_region_vid ( )
823819 } else {
824- * self . indices . get ( & r ) . unwrap_or_else ( || {
825- bug ! ( "cannot convert `{:?}` to a region vid" , r)
826- } )
820+ * self . indices
821+ . get ( & r)
822+ . unwrap_or_else ( || bug ! ( "cannot convert `{:?}` to a region vid" , r ) )
827823 }
828824 }
829825
0 commit comments