@@ -94,6 +94,7 @@ pub use self::context::{
94
94
} ;
95
95
pub use self :: instance:: { Instance , InstanceDef , ReifyReason , ShortInstance , UnusedGenericParams } ;
96
96
pub use self :: list:: { List , ListWithCachedTypeInfo } ;
97
+ pub use self :: opaque_types:: OpaqueTypeKey ;
97
98
pub use self :: parameterized:: ParameterizedOverTcx ;
98
99
pub use self :: pattern:: { Pattern , PatternKind } ;
99
100
pub use self :: predicate:: {
@@ -758,45 +759,6 @@ impl<'a, 'tcx> IntoIterator for &'a InstantiatedPredicates<'tcx> {
758
759
}
759
760
}
760
761
761
- #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash , HashStable , TyEncodable , TyDecodable ) ]
762
- #[ derive( TypeFoldable , TypeVisitable ) ]
763
- pub struct OpaqueTypeKey < ' tcx > {
764
- pub def_id : LocalDefId ,
765
- pub args : GenericArgsRef < ' tcx > ,
766
- }
767
-
768
- impl < ' tcx > OpaqueTypeKey < ' tcx > {
769
- pub fn iter_captured_args (
770
- self ,
771
- tcx : TyCtxt < ' tcx > ,
772
- ) -> impl Iterator < Item = ( usize , GenericArg < ' tcx > ) > {
773
- std:: iter:: zip ( self . args , tcx. variances_of ( self . def_id ) ) . enumerate ( ) . filter_map (
774
- |( i, ( arg, v) ) | match ( arg. unpack ( ) , v) {
775
- ( _, ty:: Invariant ) => Some ( ( i, arg) ) ,
776
- ( ty:: GenericArgKind :: Lifetime ( _) , ty:: Bivariant ) => None ,
777
- _ => bug ! ( "unexpected opaque type arg variance" ) ,
778
- } ,
779
- )
780
- }
781
-
782
- pub fn fold_captured_lifetime_args (
783
- self ,
784
- tcx : TyCtxt < ' tcx > ,
785
- mut f : impl FnMut ( Region < ' tcx > ) -> Region < ' tcx > ,
786
- ) -> Self {
787
- let Self { def_id, args } = self ;
788
- let args = std:: iter:: zip ( args, tcx. variances_of ( def_id) ) . map ( |( arg, v) | {
789
- match ( arg. unpack ( ) , v) {
790
- ( ty:: GenericArgKind :: Lifetime ( _) , ty:: Bivariant ) => arg,
791
- ( ty:: GenericArgKind :: Lifetime ( lt) , _) => f ( lt) . into ( ) ,
792
- _ => arg,
793
- }
794
- } ) ;
795
- let args = tcx. mk_args_from_iter ( args) ;
796
- Self { def_id, args }
797
- }
798
- }
799
-
800
762
#[ derive( Copy , Clone , Debug , TypeFoldable , TypeVisitable , HashStable , TyEncodable , TyDecodable ) ]
801
763
pub struct OpaqueHiddenType < ' tcx > {
802
764
/// The span of this particular definition of the opaque type. So
0 commit comments