@@ -464,9 +464,11 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Lifetime<RustInterner<'tcx>>> for Region<'t
464464 } )
465465 . intern ( interner)
466466 }
467- ReEmpty ( _) => unimplemented ! ( ) ,
468- // FIXME(chalk): need to handle ReErased
469- ReErased => unimplemented ! ( ) ,
467+ ReEmpty ( ui) => {
468+ chalk_ir:: LifetimeData :: Empty ( chalk_ir:: UniverseIndex { counter : ui. index ( ) } )
469+ . intern ( interner)
470+ }
471+ ReErased => chalk_ir:: LifetimeData :: Erased . intern ( interner) ,
470472 }
471473 }
472474}
@@ -488,12 +490,12 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
488490 name : ty:: BoundRegionKind :: BrAnon ( p. idx as u32 ) ,
489491 } )
490492 }
491- chalk_ir:: LifetimeData :: Static => ty:: RegionKind :: ReStatic ,
492- chalk_ir:: LifetimeData :: Phantom ( _, _) => unimplemented ! ( ) ,
493+ chalk_ir:: LifetimeData :: Static => return interner. tcx . lifetimes . re_static ,
493494 chalk_ir:: LifetimeData :: Empty ( ui) => {
494- ty:: RegionKind :: ReEmpty ( ty:: UniverseIndex :: from_usize ( ui. counter ) )
495+ ty:: ReEmpty ( ty:: UniverseIndex :: from_usize ( ui. counter ) )
495496 }
496- chalk_ir:: LifetimeData :: Erased => ty:: RegionKind :: ReErased ,
497+ chalk_ir:: LifetimeData :: Erased => return interner. tcx . lifetimes . re_erased ,
498+ chalk_ir:: LifetimeData :: Phantom ( void, _) => match * void { } ,
497499 } ;
498500 interner. tcx . mk_region ( kind)
499501 }
@@ -1110,32 +1112,3 @@ impl<'tcx> TypeVisitor<'tcx> for PlaceholdersCollector {
11101112 r. super_visit_with ( self )
11111113 }
11121114}
1113-
1114- /// Used to substitute specific `Regions`s with placeholders.
1115- crate struct RegionsSubstitutor < ' tcx > {
1116- tcx : TyCtxt < ' tcx > ,
1117- reempty_placeholder : ty:: Region < ' tcx > ,
1118- }
1119-
1120- impl < ' tcx > RegionsSubstitutor < ' tcx > {
1121- crate fn new ( tcx : TyCtxt < ' tcx > , reempty_placeholder : ty:: Region < ' tcx > ) -> Self {
1122- RegionsSubstitutor { tcx, reempty_placeholder }
1123- }
1124- }
1125-
1126- impl < ' tcx > TypeFolder < ' tcx > for RegionsSubstitutor < ' tcx > {
1127- fn tcx < ' b > ( & ' b self ) -> TyCtxt < ' tcx > {
1128- self . tcx
1129- }
1130-
1131- fn fold_region ( & mut self , r : Region < ' tcx > ) -> Region < ' tcx > {
1132- match r {
1133- ty:: ReEmpty ( ui) => {
1134- assert_eq ! ( ui. as_usize( ) , 0 ) ;
1135- self . reempty_placeholder
1136- }
1137-
1138- _ => r. super_fold_with ( self ) ,
1139- }
1140- }
1141- }
0 commit comments