@@ -10,40 +10,49 @@ pub fn anonymize_predicate<'tcx>(
10
10
tcx : TyCtxt < ' tcx > ,
11
11
pred : & ty:: Predicate < ' tcx > ,
12
12
) -> ty:: Predicate < ' tcx > {
13
- match * pred {
13
+ match pred. kind ( ) {
14
14
ty:: PredicateKind :: Trait ( ref data, constness) => {
15
15
ty:: PredicateKind :: Trait ( tcx. anonymize_late_bound_regions ( data) , constness)
16
+ . to_predicate ( tcx)
16
17
}
17
18
18
19
ty:: PredicateKind :: RegionOutlives ( ref data) => {
19
20
ty:: PredicateKind :: RegionOutlives ( tcx. anonymize_late_bound_regions ( data) )
21
+ . to_predicate ( tcx)
20
22
}
21
23
22
24
ty:: PredicateKind :: TypeOutlives ( ref data) => {
23
25
ty:: PredicateKind :: TypeOutlives ( tcx. anonymize_late_bound_regions ( data) )
26
+ . to_predicate ( tcx)
24
27
}
25
28
26
29
ty:: PredicateKind :: Projection ( ref data) => {
27
- ty:: PredicateKind :: Projection ( tcx. anonymize_late_bound_regions ( data) )
30
+ ty:: PredicateKind :: Projection ( tcx. anonymize_late_bound_regions ( data) ) . to_predicate ( tcx )
28
31
}
29
32
30
- ty:: PredicateKind :: WellFormed ( data) => ty:: PredicateKind :: WellFormed ( data) ,
33
+ ty:: PredicateKind :: WellFormed ( data) => {
34
+ ty:: PredicateKind :: WellFormed ( data) . to_predicate ( tcx)
35
+ }
31
36
32
- ty:: PredicateKind :: ObjectSafe ( data) => ty:: PredicateKind :: ObjectSafe ( data) ,
37
+ ty:: PredicateKind :: ObjectSafe ( data) => {
38
+ ty:: PredicateKind :: ObjectSafe ( data) . to_predicate ( tcx)
39
+ }
33
40
34
41
ty:: PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind) => {
35
- ty:: PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind)
42
+ ty:: PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind) . to_predicate ( tcx )
36
43
}
37
44
38
45
ty:: PredicateKind :: Subtype ( ref data) => {
39
- ty:: PredicateKind :: Subtype ( tcx. anonymize_late_bound_regions ( data) )
46
+ ty:: PredicateKind :: Subtype ( tcx. anonymize_late_bound_regions ( data) ) . to_predicate ( tcx )
40
47
}
41
48
42
49
ty:: PredicateKind :: ConstEvaluatable ( def_id, substs) => {
43
- ty:: PredicateKind :: ConstEvaluatable ( def_id, substs)
50
+ ty:: PredicateKind :: ConstEvaluatable ( def_id, substs) . to_predicate ( tcx )
44
51
}
45
52
46
- ty:: PredicateKind :: ConstEquate ( c1, c2) => ty:: Predicate :: ConstEquate ( c1, c2) ,
53
+ ty:: PredicateKind :: ConstEquate ( c1, c2) => {
54
+ ty:: PredicateKind :: ConstEquate ( c1, c2) . to_predicate ( tcx)
55
+ }
47
56
}
48
57
}
49
58
@@ -145,7 +154,7 @@ impl Elaborator<'tcx> {
145
154
146
155
fn elaborate ( & mut self , obligation : & PredicateObligation < ' tcx > ) {
147
156
let tcx = self . visited . tcx ;
148
- match obligation. predicate {
157
+ match obligation. predicate . kind ( ) {
149
158
ty:: PredicateKind :: Trait ( ref data, _) => {
150
159
// Get predicates declared on the trait.
151
160
let predicates = tcx. super_predicates_of ( data. def_id ( ) ) ;
@@ -250,8 +259,9 @@ impl Elaborator<'tcx> {
250
259
None
251
260
}
252
261
} )
253
- . filter ( |p| visited. insert ( p) )
254
- . map ( |p| predicate_obligation ( p, None ) ) ,
262
+ . map ( |predicate_kind| predicate_kind. to_predicate ( tcx) )
263
+ . filter ( |predicate| visited. insert ( predicate) )
264
+ . map ( |predicate| predicate_obligation ( predicate, None ) ) ,
255
265
) ;
256
266
}
257
267
}
@@ -317,7 +327,7 @@ impl<'tcx, I: Iterator<Item = PredicateObligation<'tcx>>> Iterator for FilterToT
317
327
318
328
fn next ( & mut self ) -> Option < ty:: PolyTraitRef < ' tcx > > {
319
329
while let Some ( obligation) = self . base_iterator . next ( ) {
320
- if let ty:: PredicateKind :: Trait ( data, _) = obligation. predicate {
330
+ if let ty:: PredicateKind :: Trait ( data, _) = obligation. predicate . kind ( ) {
321
331
return Some ( data. to_poly_trait_ref ( ) ) ;
322
332
}
323
333
}
0 commit comments