@@ -155,7 +155,7 @@ mod visibility;
155
155
156
156
pub use bound_constness:: BoundConstness ;
157
157
pub use impl_polarity:: ImplPolarity ;
158
- pub use predicate:: { Predicate , PredicateKind } ;
158
+ pub use predicate:: { InstantiatedPredicates , Predicate , PredicateKind } ;
159
159
pub use visibility:: Visibility ;
160
160
161
161
pub struct ResolverOutputs {
@@ -872,71 +872,6 @@ impl<'tcx> ToPredicate<'tcx> for TraitPredicate<'tcx> {
872
872
PredicateKind :: Clause ( Clause :: Trait ( self ) ) . to_predicate ( tcx)
873
873
}
874
874
}
875
-
876
- /// Represents the bounds declared on a particular set of type
877
- /// parameters. Should eventually be generalized into a flag list of
878
- /// where-clauses. You can obtain an `InstantiatedPredicates` list from a
879
- /// `GenericPredicates` by using the `instantiate` method. Note that this method
880
- /// reflects an important semantic invariant of `InstantiatedPredicates`: while
881
- /// the `GenericPredicates` are expressed in terms of the bound type
882
- /// parameters of the impl/trait/whatever, an `InstantiatedPredicates` instance
883
- /// represented a set of bounds for some particular instantiation,
884
- /// meaning that the generic parameters have been substituted with
885
- /// their values.
886
- ///
887
- /// Example:
888
- /// ```ignore (illustrative)
889
- /// struct Foo<T, U: Bar<T>> { ... }
890
- /// ```
891
- /// Here, the `GenericPredicates` for `Foo` would contain a list of bounds like
892
- /// `[[], [U:Bar<T>]]`. Now if there were some particular reference
893
- /// like `Foo<isize,usize>`, then the `InstantiatedPredicates` would be `[[],
894
- /// [usize:Bar<isize>]]`.
895
- #[ derive( Clone , Debug , TypeFoldable , TypeVisitable ) ]
896
- pub struct InstantiatedPredicates < ' tcx > {
897
- pub predicates : Vec < Predicate < ' tcx > > ,
898
- pub spans : Vec < Span > ,
899
- }
900
-
901
- impl < ' tcx > InstantiatedPredicates < ' tcx > {
902
- pub fn empty ( ) -> InstantiatedPredicates < ' tcx > {
903
- InstantiatedPredicates { predicates : vec ! [ ] , spans : vec ! [ ] }
904
- }
905
-
906
- pub fn is_empty ( & self ) -> bool {
907
- self . predicates . is_empty ( )
908
- }
909
-
910
- pub fn iter ( & self ) -> <& Self as IntoIterator >:: IntoIter {
911
- ( & self ) . into_iter ( )
912
- }
913
- }
914
-
915
- impl < ' tcx > IntoIterator for InstantiatedPredicates < ' tcx > {
916
- type Item = ( Predicate < ' tcx > , Span ) ;
917
-
918
- type IntoIter = std:: iter:: Zip < std:: vec:: IntoIter < Predicate < ' tcx > > , std:: vec:: IntoIter < Span > > ;
919
-
920
- fn into_iter ( self ) -> Self :: IntoIter {
921
- debug_assert_eq ! ( self . predicates. len( ) , self . spans. len( ) ) ;
922
- std:: iter:: zip ( self . predicates , self . spans )
923
- }
924
- }
925
-
926
- impl < ' a , ' tcx > IntoIterator for & ' a InstantiatedPredicates < ' tcx > {
927
- type Item = ( Predicate < ' tcx > , Span ) ;
928
-
929
- type IntoIter = std:: iter:: Zip <
930
- std:: iter:: Copied < std:: slice:: Iter < ' a , Predicate < ' tcx > > > ,
931
- std:: iter:: Copied < std:: slice:: Iter < ' a , Span > > ,
932
- > ;
933
-
934
- fn into_iter ( self ) -> Self :: IntoIter {
935
- debug_assert_eq ! ( self . predicates. len( ) , self . spans. len( ) ) ;
936
- std:: iter:: zip ( self . predicates . iter ( ) . copied ( ) , self . spans . iter ( ) . copied ( ) )
937
- }
938
- }
939
-
940
875
#[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash , HashStable , TyEncodable , TyDecodable , Lift ) ]
941
876
#[ derive( TypeFoldable , TypeVisitable ) ]
942
877
pub struct OpaqueTypeKey < ' tcx > {
0 commit comments