@@ -10,50 +10,44 @@ pub fn anonymize_predicate<'tcx>(
10
10
tcx : TyCtxt < ' tcx > ,
11
11
pred : ty:: Predicate < ' tcx > ,
12
12
) -> ty:: Predicate < ' tcx > {
13
- match pred. kind ( ) {
13
+ let kind = pred. kind ( ) ;
14
+ let new = match kind {
14
15
& ty:: PredicateKind :: Trait ( ref data, constness) => {
15
16
ty:: PredicateKind :: Trait ( tcx. anonymize_late_bound_regions ( data) , constness)
16
- . to_predicate ( tcx)
17
17
}
18
18
19
19
ty:: PredicateKind :: RegionOutlives ( data) => {
20
20
ty:: PredicateKind :: RegionOutlives ( tcx. anonymize_late_bound_regions ( data) )
21
- . to_predicate ( tcx)
22
21
}
23
22
24
23
ty:: PredicateKind :: TypeOutlives ( data) => {
25
24
ty:: PredicateKind :: TypeOutlives ( tcx. anonymize_late_bound_regions ( data) )
26
- . to_predicate ( tcx)
27
25
}
28
26
29
27
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) )
31
29
}
32
30
33
- & ty:: PredicateKind :: WellFormed ( data) => {
34
- ty:: PredicateKind :: WellFormed ( data) . to_predicate ( tcx)
35
- }
31
+ & ty:: PredicateKind :: WellFormed ( data) => ty:: PredicateKind :: WellFormed ( data) ,
36
32
37
- & ty:: PredicateKind :: ObjectSafe ( data) => {
38
- ty:: PredicateKind :: ObjectSafe ( data) . to_predicate ( tcx)
39
- }
33
+ & ty:: PredicateKind :: ObjectSafe ( data) => ty:: PredicateKind :: ObjectSafe ( data) ,
40
34
41
35
& 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)
43
37
}
44
38
45
39
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) )
47
41
}
48
42
49
43
& ty:: PredicateKind :: ConstEvaluatable ( def_id, substs) => {
50
- ty:: PredicateKind :: ConstEvaluatable ( def_id, substs) . to_predicate ( tcx )
44
+ ty:: PredicateKind :: ConstEvaluatable ( def_id, substs)
51
45
}
52
46
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 }
57
51
}
58
52
59
53
struct PredicateSet < ' tcx > {
0 commit comments