@@ -35,7 +35,7 @@ use rustc_ast::ast;
3535use rustc_middle:: traits:: { ChalkEnvironmentAndGoal , ChalkRustInterner as RustInterner } ;
3636use rustc_middle:: ty:: fold:: TypeFolder ;
3737use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind , SubstsRef } ;
38- use rustc_middle:: ty:: { self , Binder , Region , RegionKind , Ty , TyCtxt , TypeFoldable , TypeVisitor } ;
38+ use rustc_middle:: ty:: { self , Binder , Region , Ty , TyCtxt , TypeFoldable , TypeVisitor } ;
3939use rustc_span:: def_id:: DefId ;
4040
4141use chalk_ir:: { FnSig , ForeignDefId } ;
@@ -449,53 +449,49 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
449449
450450impl < ' tcx > LowerInto < ' tcx , chalk_ir:: Lifetime < RustInterner < ' tcx > > > for Region < ' tcx > {
451451 fn lower_into ( self , interner : RustInterner < ' tcx > ) -> chalk_ir:: Lifetime < RustInterner < ' tcx > > {
452- use rustc_middle:: ty:: RegionKind :: * ;
453-
454452 match * self {
455- ReEarlyBound ( _) => {
453+ ty :: ReEarlyBound ( _) => {
456454 panic ! ( "Should have already been substituted." ) ;
457455 }
458- ReLateBound ( db, br) => chalk_ir:: LifetimeData :: BoundVar ( chalk_ir:: BoundVar :: new (
456+ ty :: ReLateBound ( db, br) => chalk_ir:: LifetimeData :: BoundVar ( chalk_ir:: BoundVar :: new (
459457 chalk_ir:: DebruijnIndex :: new ( db. as_u32 ( ) ) ,
460458 br. var . as_usize ( ) ,
461459 ) )
462460 . intern ( interner) ,
463- ReFree ( _) => unimplemented ! ( ) ,
464- ReStatic => chalk_ir:: LifetimeData :: Static . intern ( interner) ,
465- ReVar ( _) => unimplemented ! ( ) ,
466- RePlaceholder ( placeholder_region) => {
461+ ty :: ReFree ( _) => unimplemented ! ( ) ,
462+ ty :: ReStatic => chalk_ir:: LifetimeData :: Static . intern ( interner) ,
463+ ty :: ReVar ( _) => unimplemented ! ( ) ,
464+ ty :: RePlaceholder ( placeholder_region) => {
467465 chalk_ir:: LifetimeData :: Placeholder ( chalk_ir:: PlaceholderIndex {
468466 ui : chalk_ir:: UniverseIndex { counter : placeholder_region. universe . index ( ) } ,
469467 idx : 0 ,
470468 } )
471469 . intern ( interner)
472470 }
473- ReEmpty ( ui) => {
471+ ty :: ReEmpty ( ui) => {
474472 chalk_ir:: LifetimeData :: Empty ( chalk_ir:: UniverseIndex { counter : ui. index ( ) } )
475473 . intern ( interner)
476474 }
477- ReErased => chalk_ir:: LifetimeData :: Erased . intern ( interner) ,
475+ ty :: ReErased => chalk_ir:: LifetimeData :: Erased . intern ( interner) ,
478476 }
479477 }
480478}
481479
482480impl < ' tcx > LowerInto < ' tcx , Region < ' tcx > > for & chalk_ir:: Lifetime < RustInterner < ' tcx > > {
483481 fn lower_into ( self , interner : RustInterner < ' tcx > ) -> Region < ' tcx > {
484482 let kind = match self . data ( interner) {
485- chalk_ir:: LifetimeData :: BoundVar ( var) => ty:: RegionKind :: ReLateBound (
483+ chalk_ir:: LifetimeData :: BoundVar ( var) => ty:: ReLateBound (
486484 ty:: DebruijnIndex :: from_u32 ( var. debruijn . depth ( ) ) ,
487485 ty:: BoundRegion {
488486 var : ty:: BoundVar :: from_usize ( var. index ) ,
489487 kind : ty:: BrAnon ( var. index as u32 ) ,
490488 } ,
491489 ) ,
492490 chalk_ir:: LifetimeData :: InferenceVar ( _var) => unimplemented ! ( ) ,
493- chalk_ir:: LifetimeData :: Placeholder ( p) => {
494- ty:: RegionKind :: RePlaceholder ( ty:: Placeholder {
495- universe : ty:: UniverseIndex :: from_usize ( p. ui . counter ) ,
496- name : ty:: BoundRegionKind :: BrAnon ( p. idx as u32 ) ,
497- } )
498- }
491+ chalk_ir:: LifetimeData :: Placeholder ( p) => ty:: RePlaceholder ( ty:: Placeholder {
492+ universe : ty:: UniverseIndex :: from_usize ( p. ui . counter ) ,
493+ name : ty:: BoundRegionKind :: BrAnon ( p. idx as u32 ) ,
494+ } ) ,
499495 chalk_ir:: LifetimeData :: Static => return interner. tcx . lifetimes . re_static ,
500496 chalk_ir:: LifetimeData :: Empty ( ui) => {
501497 ty:: ReEmpty ( ty:: UniverseIndex :: from_usize ( ui. counter ) )
@@ -982,7 +978,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for NamedBoundVarSubstitutor<'a, 'tcx> {
982978 ty:: BrNamed ( def_id, _name) => match self . named_parameters . get ( & def_id) {
983979 Some ( idx) => {
984980 let new_br = ty:: BoundRegion { var : br. var , kind : ty:: BrAnon ( * idx) } ;
985- return self . tcx . mk_region ( RegionKind :: ReLateBound ( index, new_br) ) ;
981+ return self . tcx . mk_region ( ty :: ReLateBound ( index, new_br) ) ;
986982 }
987983 None => panic ! ( "Missing `BrNamed`." ) ,
988984 } ,
@@ -1064,14 +1060,14 @@ impl<'tcx> TypeFolder<'tcx> for ParamsSubstitutor<'tcx> {
10641060 var : ty:: BoundVar :: from_u32 ( * idx) ,
10651061 kind : ty:: BrAnon ( * idx) ,
10661062 } ;
1067- self . tcx . mk_region ( RegionKind :: ReLateBound ( self . binder_index , br) )
1063+ self . tcx . mk_region ( ty :: ReLateBound ( self . binder_index , br) )
10681064 }
10691065 None => {
10701066 let idx = self . named_regions . len ( ) as u32 ;
10711067 let br =
10721068 ty:: BoundRegion { var : ty:: BoundVar :: from_u32 ( idx) , kind : ty:: BrAnon ( idx) } ;
10731069 self . named_regions . insert ( _re. def_id , idx) ;
1074- self . tcx . mk_region ( RegionKind :: ReLateBound ( self . binder_index , br) )
1070+ self . tcx . mk_region ( ty :: ReLateBound ( self . binder_index , br) )
10751071 }
10761072 } ,
10771073
0 commit comments