@@ -14,7 +14,6 @@ use tracing::instrument;
1414use crate :: data_structures:: SsoHashSet ;
1515use crate :: fold:: { FallibleTypeFolder , TypeFoldable , TypeFolder , TypeSuperFoldable } ;
1616use crate :: inherent:: * ;
17- use crate :: lift:: Lift ;
1817use crate :: visit:: { Flags , TypeSuperVisitable , TypeVisitable , TypeVisitableExt , TypeVisitor } ;
1918use crate :: { self as ty, DebruijnIndex , Interner , UniverseIndex , Unnormalized } ;
2019
@@ -27,7 +26,7 @@ use crate::{self as ty, DebruijnIndex, Interner, UniverseIndex, Unnormalized};
2726///
2827/// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro.
2928#[ derive_where( Clone , Copy , Hash , PartialEq , Debug ; I : Interner , T ) ]
30- #[ derive( GenericTypeVisitable ) ]
29+ #[ derive( GenericTypeVisitable , Lift_Generic ) ]
3130#[ cfg_attr( feature = "nightly" , derive( StableHash_NoContext ) ) ]
3231pub struct Binder < I : Interner , T > {
3332 value : T ,
@@ -36,23 +35,6 @@ pub struct Binder<I: Interner, T> {
3635
3736impl < I : Interner , T : Eq > Eq for Binder < I , T > { }
3837
39- // FIXME: We manually derive `Lift` because the `derive(Lift_Generic)` doesn't
40- // understand how to turn `T` to `T::Lifted` in the output `type Lifted`.
41- impl < I : Interner , U : Interner , T > Lift < U > for Binder < I , T >
42- where
43- T : Lift < U > ,
44- I :: BoundVarKinds : Lift < U , Lifted = U :: BoundVarKinds > ,
45- {
46- type Lifted = Binder < U , T :: Lifted > ;
47-
48- fn lift_to_interner ( self , cx : U ) -> Self :: Lifted {
49- Binder {
50- value : self . value . lift_to_interner ( cx) ,
51- bound_vars : self . bound_vars . lift_to_interner ( cx) ,
52- }
53- }
54- }
55-
5638#[ cfg( feature = "nightly" ) ]
5739macro_rules! impl_binder_encode_decode {
5840 ( $( $t: ty) ,+ $( , ) ?) => {
@@ -966,12 +948,13 @@ pub enum BoundVarIndexKind {
966948/// identified by both a universe, as well as a name residing within that universe. Distinct bound
967949/// regions/types/consts within the same universe simply have an unknown relationship to one
968950#[ derive_where( Clone , Copy , PartialOrd , Ord , PartialEq , Eq , Hash ; I : Interner , T ) ]
969- #[ derive( TypeVisitable_Generic , TypeFoldable_Generic , GenericTypeVisitable ) ]
951+ #[ derive( TypeVisitable_Generic , TypeFoldable_Generic , GenericTypeVisitable , Lift_Generic ) ]
970952#[ cfg_attr(
971953 feature = "nightly" ,
972954 derive( Encodable_NoContext , Decodable_NoContext , StableHash_NoContext )
973955) ]
974956pub struct Placeholder < I : Interner , T > {
957+ #[ lift( identity) ]
975958 pub universe : UniverseIndex ,
976959 pub bound : T ,
977960 #[ type_foldable( identity) ]
@@ -989,21 +972,6 @@ impl<I: Interner, T: fmt::Debug> fmt::Debug for ty::Placeholder<I, T> {
989972 }
990973}
991974
992- impl < I : Interner , U : Interner , T > Lift < U > for Placeholder < I , T >
993- where
994- T : Lift < U > ,
995- {
996- type Lifted = Placeholder < U , T :: Lifted > ;
997-
998- fn lift_to_interner ( self , cx : U ) -> Self :: Lifted {
999- Placeholder {
1000- universe : self . universe ,
1001- bound : self . bound . lift_to_interner ( cx) ,
1002- _tcx : PhantomData ,
1003- }
1004- }
1005- }
1006-
1007975#[ derive_where( Clone , Copy , PartialEq , Eq , Hash ; I : Interner ) ]
1008976#[ derive( Lift_Generic , GenericTypeVisitable ) ]
1009977#[ cfg_attr(
@@ -1174,27 +1142,17 @@ impl<I: Interner> PlaceholderRegion<I> {
11741142}
11751143
11761144#[ derive_where( Clone , Copy , PartialEq , Eq , Hash ; I : Interner ) ]
1177- #[ derive( GenericTypeVisitable ) ]
1145+ #[ derive( GenericTypeVisitable , Lift_Generic ) ]
11781146#[ cfg_attr(
11791147 feature = "nightly" ,
11801148 derive( Encodable_NoContext , Decodable_NoContext , StableHash_NoContext )
11811149) ]
11821150pub struct BoundTy < I : Interner > {
1151+ #[ lift( identity) ]
11831152 pub var : ty:: BoundVar ,
11841153 pub kind : BoundTyKind < I > ,
11851154}
11861155
1187- impl < I : Interner , U : Interner > Lift < U > for BoundTy < I >
1188- where
1189- BoundTyKind < I > : Lift < U , Lifted = BoundTyKind < U > > ,
1190- {
1191- type Lifted = BoundTy < U > ;
1192-
1193- fn lift_to_interner ( self , cx : U ) -> Self :: Lifted {
1194- BoundTy { var : self . var , kind : self . kind . lift_to_interner ( cx) }
1195- }
1196- }
1197-
11981156impl < I : Interner > fmt:: Debug for ty:: BoundTy < I > {
11991157 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
12001158 match self . kind {
0 commit comments