@@ -10,50 +10,44 @@ pub fn anonymize_predicate<'tcx>(
1010 tcx : TyCtxt < ' tcx > ,
1111 pred : ty:: Predicate < ' tcx > ,
1212) -> ty:: Predicate < ' tcx > {
13- match pred. kind ( ) {
13+ let kind = pred. kind ( ) ;
14+ let new = match kind {
1415 & ty:: PredicateKind :: Trait ( ref data, constness) => {
1516 ty:: PredicateKind :: Trait ( tcx. anonymize_late_bound_regions ( data) , constness)
16- . to_predicate ( tcx)
1717 }
1818
1919 ty:: PredicateKind :: RegionOutlives ( data) => {
2020 ty:: PredicateKind :: RegionOutlives ( tcx. anonymize_late_bound_regions ( data) )
21- . to_predicate ( tcx)
2221 }
2322
2423 ty:: PredicateKind :: TypeOutlives ( data) => {
2524 ty:: PredicateKind :: TypeOutlives ( tcx. anonymize_late_bound_regions ( data) )
26- . to_predicate ( tcx)
2725 }
2826
2927 ty:: PredicateKind :: Projection ( data) => {
30- ty:: PredicateKind :: Projection ( tcx. anonymize_late_bound_regions ( data) ) . to_predicate ( tcx )
28+ ty:: PredicateKind :: Projection ( tcx. anonymize_late_bound_regions ( data) )
3129 }
3230
33- & ty:: PredicateKind :: WellFormed ( data) => {
34- ty:: PredicateKind :: WellFormed ( data) . to_predicate ( tcx)
35- }
31+ & ty:: PredicateKind :: WellFormed ( data) => ty:: PredicateKind :: WellFormed ( data) ,
3632
37- & ty:: PredicateKind :: ObjectSafe ( data) => {
38- ty:: PredicateKind :: ObjectSafe ( data) . to_predicate ( tcx)
39- }
33+ & ty:: PredicateKind :: ObjectSafe ( data) => ty:: PredicateKind :: ObjectSafe ( data) ,
4034
4135 & ty:: PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind) => {
42- ty:: PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind) . to_predicate ( tcx )
36+ ty:: PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind)
4337 }
4438
4539 ty:: PredicateKind :: Subtype ( data) => {
46- ty:: PredicateKind :: Subtype ( tcx. anonymize_late_bound_regions ( data) ) . to_predicate ( tcx )
40+ ty:: PredicateKind :: Subtype ( tcx. anonymize_late_bound_regions ( data) )
4741 }
4842
4943 & ty:: PredicateKind :: ConstEvaluatable ( def_id, substs) => {
50- ty:: PredicateKind :: ConstEvaluatable ( def_id, substs) . to_predicate ( tcx )
44+ ty:: PredicateKind :: ConstEvaluatable ( def_id, substs)
5145 }
5246
53- ty:: PredicateKind :: ConstEquate ( c1, c2) => {
54- ty :: PredicateKind :: ConstEquate ( c1 , c2 ) . to_predicate ( tcx )
55- }
56- }
47+ ty:: PredicateKind :: ConstEquate ( c1, c2) => ty :: PredicateKind :: ConstEquate ( c1 , c2 ) ,
48+ } ;
49+
50+ if new != * kind { new . to_predicate ( tcx ) } else { pred }
5751}
5852
5953struct PredicateSet < ' tcx > {
0 commit comments