@@ -35,7 +35,7 @@ use rustc_ast::ast;
35
35
use rustc_middle:: traits:: { ChalkEnvironmentAndGoal , ChalkRustInterner as RustInterner } ;
36
36
use rustc_middle:: ty:: fold:: TypeFolder ;
37
37
use 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 } ;
39
39
use rustc_span:: def_id:: DefId ;
40
40
41
41
use chalk_ir:: { FnSig , ForeignDefId } ;
@@ -449,53 +449,49 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
449
449
450
450
impl < ' tcx > LowerInto < ' tcx , chalk_ir:: Lifetime < RustInterner < ' tcx > > > for Region < ' tcx > {
451
451
fn lower_into ( self , interner : RustInterner < ' tcx > ) -> chalk_ir:: Lifetime < RustInterner < ' tcx > > {
452
- use rustc_middle:: ty:: RegionKind :: * ;
453
-
454
452
match * self {
455
- ReEarlyBound ( _) => {
453
+ ty :: ReEarlyBound ( _) => {
456
454
panic ! ( "Should have already been substituted." ) ;
457
455
}
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 (
459
457
chalk_ir:: DebruijnIndex :: new ( db. as_u32 ( ) ) ,
460
458
br. var . as_usize ( ) ,
461
459
) )
462
460
. 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) => {
467
465
chalk_ir:: LifetimeData :: Placeholder ( chalk_ir:: PlaceholderIndex {
468
466
ui : chalk_ir:: UniverseIndex { counter : placeholder_region. universe . index ( ) } ,
469
467
idx : 0 ,
470
468
} )
471
469
. intern ( interner)
472
470
}
473
- ReEmpty ( ui) => {
471
+ ty :: ReEmpty ( ui) => {
474
472
chalk_ir:: LifetimeData :: Empty ( chalk_ir:: UniverseIndex { counter : ui. index ( ) } )
475
473
. intern ( interner)
476
474
}
477
- ReErased => chalk_ir:: LifetimeData :: Erased . intern ( interner) ,
475
+ ty :: ReErased => chalk_ir:: LifetimeData :: Erased . intern ( interner) ,
478
476
}
479
477
}
480
478
}
481
479
482
480
impl < ' tcx > LowerInto < ' tcx , Region < ' tcx > > for & chalk_ir:: Lifetime < RustInterner < ' tcx > > {
483
481
fn lower_into ( self , interner : RustInterner < ' tcx > ) -> Region < ' tcx > {
484
482
let kind = match self . data ( interner) {
485
- chalk_ir:: LifetimeData :: BoundVar ( var) => ty:: RegionKind :: ReLateBound (
483
+ chalk_ir:: LifetimeData :: BoundVar ( var) => ty:: ReLateBound (
486
484
ty:: DebruijnIndex :: from_u32 ( var. debruijn . depth ( ) ) ,
487
485
ty:: BoundRegion {
488
486
var : ty:: BoundVar :: from_usize ( var. index ) ,
489
487
kind : ty:: BrAnon ( var. index as u32 ) ,
490
488
} ,
491
489
) ,
492
490
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
+ } ) ,
499
495
chalk_ir:: LifetimeData :: Static => return interner. tcx . lifetimes . re_static ,
500
496
chalk_ir:: LifetimeData :: Empty ( ui) => {
501
497
ty:: ReEmpty ( ty:: UniverseIndex :: from_usize ( ui. counter ) )
@@ -982,7 +978,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for NamedBoundVarSubstitutor<'a, 'tcx> {
982
978
ty:: BrNamed ( def_id, _name) => match self . named_parameters . get ( & def_id) {
983
979
Some ( idx) => {
984
980
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) ) ;
986
982
}
987
983
None => panic ! ( "Missing `BrNamed`." ) ,
988
984
} ,
@@ -1064,14 +1060,14 @@ impl<'tcx> TypeFolder<'tcx> for ParamsSubstitutor<'tcx> {
1064
1060
var : ty:: BoundVar :: from_u32 ( * idx) ,
1065
1061
kind : ty:: BrAnon ( * idx) ,
1066
1062
} ;
1067
- self . tcx . mk_region ( RegionKind :: ReLateBound ( self . binder_index , br) )
1063
+ self . tcx . mk_region ( ty :: ReLateBound ( self . binder_index , br) )
1068
1064
}
1069
1065
None => {
1070
1066
let idx = self . named_regions . len ( ) as u32 ;
1071
1067
let br =
1072
1068
ty:: BoundRegion { var : ty:: BoundVar :: from_u32 ( idx) , kind : ty:: BrAnon ( idx) } ;
1073
1069
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) )
1075
1071
}
1076
1072
} ,
1077
1073
0 commit comments