@@ -109,7 +109,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
109109 . iter ( )
110110 . find ( |ur_vid| self . eval_equal ( vid, * * ur_vid) )
111111 . and_then ( |ur_vid| self . definitions [ * ur_vid] . external_name )
112- . unwrap_or ( infcx. tcx . lifetimes . re_root_empty ) ,
112+ . unwrap_or ( infcx. tcx . lifetimes . re_erased ) ,
113113 _ => region,
114114 } ) ;
115115
@@ -433,7 +433,7 @@ struct ReverseMapper<'tcx> {
433433
434434 key : ty:: OpaqueTypeKey < ' tcx > ,
435435 map : FxHashMap < GenericArg < ' tcx > , GenericArg < ' tcx > > ,
436- map_missing_regions_to_empty : bool ,
436+ do_not_error : bool ,
437437
438438 /// initially `Some`, set to `None` once error has been reported
439439 hidden_ty : Option < Ty < ' tcx > > ,
@@ -450,29 +450,19 @@ impl<'tcx> ReverseMapper<'tcx> {
450450 hidden_ty : Ty < ' tcx > ,
451451 span : Span ,
452452 ) -> Self {
453- Self {
454- tcx,
455- key,
456- map,
457- map_missing_regions_to_empty : false ,
458- hidden_ty : Some ( hidden_ty) ,
459- span,
460- }
453+ Self { tcx, key, map, do_not_error : false , hidden_ty : Some ( hidden_ty) , span }
461454 }
462455
463- fn fold_kind_mapping_missing_regions_to_empty (
464- & mut self ,
465- kind : GenericArg < ' tcx > ,
466- ) -> GenericArg < ' tcx > {
467- assert ! ( !self . map_missing_regions_to_empty) ;
468- self . map_missing_regions_to_empty = true ;
456+ fn fold_kind_no_missing_regions_error ( & mut self , kind : GenericArg < ' tcx > ) -> GenericArg < ' tcx > {
457+ assert ! ( !self . do_not_error) ;
458+ self . do_not_error = true ;
469459 let kind = kind. fold_with ( self ) ;
470- self . map_missing_regions_to_empty = false ;
460+ self . do_not_error = false ;
471461 kind
472462 }
473463
474464 fn fold_kind_normally ( & mut self , kind : GenericArg < ' tcx > ) -> GenericArg < ' tcx > {
475- assert ! ( !self . map_missing_regions_to_empty ) ;
465+ assert ! ( !self . do_not_error ) ;
476466 kind. fold_with ( self )
477467 }
478468}
@@ -496,9 +486,9 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
496486 ty:: ReErased => return r,
497487
498488 // The regions that we expect from borrow checking.
499- ty:: ReEarlyBound ( _) | ty:: ReFree ( _) | ty :: ReEmpty ( ty :: UniverseIndex :: ROOT ) => { }
489+ ty:: ReEarlyBound ( _) | ty:: ReFree ( _) => { }
500490
501- ty:: ReEmpty ( _ ) | ty :: RePlaceholder ( _) | ty:: ReVar ( _) => {
491+ ty:: RePlaceholder ( _) | ty:: ReVar ( _) => {
502492 // All of the regions in the type should either have been
503493 // erased by writeback, or mapped back to named regions by
504494 // borrow checking.
@@ -510,7 +500,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
510500 match self . map . get ( & r. into ( ) ) . map ( |k| k. unpack ( ) ) {
511501 Some ( GenericArgKind :: Lifetime ( r1) ) => r1,
512502 Some ( u) => panic ! ( "region mapped to unexpected kind: {:?}" , u) ,
513- None if self . map_missing_regions_to_empty => self . tcx . lifetimes . re_root_empty ,
503+ None if self . do_not_error => self . tcx . lifetimes . re_static ,
514504 None if generics. parent . is_some ( ) => {
515505 if let Some ( hidden_ty) = self . hidden_ty . take ( ) {
516506 unexpected_hidden_region_diagnostic (
@@ -522,7 +512,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
522512 )
523513 . emit ( ) ;
524514 }
525- self . tcx . lifetimes . re_root_empty
515+ self . tcx . lifetimes . re_static
526516 }
527517 None => {
528518 self . tcx
@@ -574,7 +564,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
574564 let substs = self . tcx . mk_substs ( substs. iter ( ) . enumerate ( ) . map ( |( index, kind) | {
575565 if index < generics. parent_count {
576566 // Accommodate missing regions in the parent kinds...
577- self . fold_kind_mapping_missing_regions_to_empty ( kind)
567+ self . fold_kind_no_missing_regions_error ( kind)
578568 } else {
579569 // ...but not elsewhere.
580570 self . fold_kind_normally ( kind)
@@ -589,7 +579,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
589579 let substs = self . tcx . mk_substs ( substs. iter ( ) . enumerate ( ) . map ( |( index, kind) | {
590580 if index < generics. parent_count {
591581 // Accommodate missing regions in the parent kinds...
592- self . fold_kind_mapping_missing_regions_to_empty ( kind)
582+ self . fold_kind_no_missing_regions_error ( kind)
593583 } else {
594584 // ...but not elsewhere.
595585 self . fold_kind_normally ( kind)
0 commit comments