@@ -982,7 +982,7 @@ impl<'a, 'gcx, 'tcx> Generics {
982
982
#[ derive( Clone , Default ) ]
983
983
pub struct GenericPredicates < ' tcx > {
984
984
pub parent : Option < DefId > ,
985
- pub predicates : Vec < Predicate < ' tcx > > ,
985
+ pub predicates : Vec < ( Predicate < ' tcx > , Span ) > ,
986
986
}
987
987
988
988
impl < ' tcx > serialize:: UseSpecializedEncodable for GenericPredicates < ' tcx > { }
@@ -998,7 +998,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
998
998
pub fn instantiate_own ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > , substs : & Substs < ' tcx > )
999
999
-> InstantiatedPredicates < ' tcx > {
1000
1000
InstantiatedPredicates {
1001
- predicates : self . predicates . subst ( tcx, substs)
1001
+ predicates : self . predicates . iter ( ) . map ( | ( p , _ ) | p . subst ( tcx, substs) ) . collect ( ) ,
1002
1002
}
1003
1003
}
1004
1004
@@ -1008,7 +1008,9 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
1008
1008
if let Some ( def_id) = self . parent {
1009
1009
tcx. predicates_of ( def_id) . instantiate_into ( tcx, instantiated, substs) ;
1010
1010
}
1011
- instantiated. predicates . extend ( self . predicates . iter ( ) . map ( |p| p. subst ( tcx, substs) ) )
1011
+ instantiated. predicates . extend (
1012
+ self . predicates . iter ( ) . map ( |( p, _) | p. subst ( tcx, substs) ) ,
1013
+ ) ;
1012
1014
}
1013
1015
1014
1016
pub fn instantiate_identity ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > )
@@ -1023,7 +1025,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
1023
1025
if let Some ( def_id) = self . parent {
1024
1026
tcx. predicates_of ( def_id) . instantiate_identity_into ( tcx, instantiated) ;
1025
1027
}
1026
- instantiated. predicates . extend ( & self . predicates )
1028
+ instantiated. predicates . extend ( self . predicates . iter ( ) . map ( | & ( p , _ ) | p ) )
1027
1029
}
1028
1030
1029
1031
pub fn instantiate_supertrait ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
@@ -1032,7 +1034,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
1032
1034
{
1033
1035
assert_eq ! ( self . parent, None ) ;
1034
1036
InstantiatedPredicates {
1035
- predicates : self . predicates . iter ( ) . map ( |pred| {
1037
+ predicates : self . predicates . iter ( ) . map ( |( pred, _ ) | {
1036
1038
pred. subst_supertrait ( tcx, poly_trait_ref)
1037
1039
} ) . collect ( )
1038
1040
}
@@ -2351,7 +2353,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
2351
2353
substs : tcx. mk_substs_trait ( ty, & [ ] )
2352
2354
} ) . to_predicate ( ) ;
2353
2355
let predicates = tcx. predicates_of ( self . did ) . predicates ;
2354
- if predicates. into_iter ( ) . any ( |p | p == sized_predicate) {
2356
+ if predicates. into_iter ( ) . any ( |( p , _ ) | p == sized_predicate) {
2355
2357
vec ! [ ]
2356
2358
} else {
2357
2359
vec ! [ ty]
0 commit comments