@@ -9,7 +9,7 @@ use rustc_hir::def::DefKind;
9
9
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
10
10
use rustc_hir:: intravisit:: { self , Visitor } ;
11
11
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
12
- use rustc_middle:: ty:: { GenericPredicates , ImplTraitInTraitData , ToPredicate } ;
12
+ use rustc_middle:: ty:: { GenericPredicates , ImplTraitInTraitData , Upcast } ;
13
13
use rustc_middle:: { bug, span_bug} ;
14
14
use rustc_span:: symbol:: Ident ;
15
15
use rustc_span:: { Span , DUMMY_SP } ;
@@ -40,11 +40,13 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
40
40
// `tcx.def_span(def_id);`
41
41
let span = DUMMY_SP ;
42
42
43
- result. predicates =
44
- tcx. arena . alloc_from_iter ( result. predicates . iter ( ) . copied ( ) . chain ( std:: iter:: once ( (
45
- ty:: TraitRef :: identity ( tcx, def_id) . to_predicate ( tcx) ,
46
- span,
47
- ) ) ) ) ;
43
+ result. predicates = tcx. arena . alloc_from_iter (
44
+ result
45
+ . predicates
46
+ . iter ( )
47
+ . copied ( )
48
+ . chain ( std:: iter:: once ( ( ty:: TraitRef :: identity ( tcx, def_id) . upcast ( tcx) , span) ) ) ,
49
+ ) ;
48
50
}
49
51
debug ! ( "predicates_of(def_id={:?}) = {:?}" , def_id, result) ;
50
52
result
@@ -165,7 +167,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
165
167
// (see below). Recall that a default impl is not itself an impl, but rather a
166
168
// set of defaults that can be incorporated into another impl.
167
169
if let Some ( trait_ref) = is_default_impl_trait {
168
- predicates. insert ( ( trait_ref. to_predicate ( tcx) , tcx. def_span ( def_id) ) ) ;
170
+ predicates. insert ( ( trait_ref. upcast ( tcx) , tcx. def_span ( def_id) ) ) ;
169
171
}
170
172
171
173
// Collect the predicates that were written inline by the user on each
@@ -196,10 +198,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
196
198
. no_bound_vars ( )
197
199
. expect ( "const parameters cannot be generic" ) ;
198
200
let ct = icx. lowerer ( ) . lower_const_param ( param. hir_id , ct_ty) ;
199
- predicates. insert ( (
200
- ty:: ClauseKind :: ConstArgHasType ( ct, ct_ty) . to_predicate ( tcx) ,
201
- param. span ,
202
- ) ) ;
201
+ predicates
202
+ . insert ( ( ty:: ClauseKind :: ConstArgHasType ( ct, ct_ty) . upcast ( tcx) , param. span ) ) ;
203
203
}
204
204
}
205
205
}
@@ -228,7 +228,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
228
228
ty:: ClauseKind :: WellFormed ( ty. into ( ) ) ,
229
229
bound_vars,
230
230
) ;
231
- predicates. insert ( ( predicate. to_predicate ( tcx) , span) ) ;
231
+ predicates. insert ( ( predicate. upcast ( tcx) , span) ) ;
232
232
}
233
233
}
234
234
@@ -257,8 +257,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
257
257
)
258
258
}
259
259
} ;
260
- let pred = ty :: ClauseKind :: RegionOutlives ( ty :: OutlivesPredicate ( r1 , r2 ) )
261
- . to_predicate ( tcx) ;
260
+ let pred =
261
+ ty :: ClauseKind :: RegionOutlives ( ty :: OutlivesPredicate ( r1 , r2 ) ) . upcast ( tcx) ;
262
262
( pred, span)
263
263
} ) )
264
264
}
@@ -328,12 +328,12 @@ fn compute_bidirectional_outlives_predicates<'tcx>(
328
328
let span = tcx. def_span ( param. def_id ) ;
329
329
predicates. push ( (
330
330
ty:: ClauseKind :: RegionOutlives ( ty:: OutlivesPredicate ( orig_lifetime, dup_lifetime) )
331
- . to_predicate ( tcx) ,
331
+ . upcast ( tcx) ,
332
332
span,
333
333
) ) ;
334
334
predicates. push ( (
335
335
ty:: ClauseKind :: RegionOutlives ( ty:: OutlivesPredicate ( dup_lifetime, orig_lifetime) )
336
- . to_predicate ( tcx) ,
336
+ . upcast ( tcx) ,
337
337
span,
338
338
) ) ;
339
339
}
@@ -354,8 +354,7 @@ fn const_evaluatable_predicates_of(
354
354
let ct = ty:: Const :: from_anon_const ( self . tcx , c. def_id ) ;
355
355
if let ty:: ConstKind :: Unevaluated ( _) = ct. kind ( ) {
356
356
let span = self . tcx . def_span ( c. def_id ) ;
357
- self . preds
358
- . insert ( ( ty:: ClauseKind :: ConstEvaluatable ( ct) . to_predicate ( self . tcx ) , span) ) ;
357
+ self . preds . insert ( ( ty:: ClauseKind :: ConstEvaluatable ( ct) . upcast ( self . tcx ) , span) ) ;
359
358
}
360
359
}
361
360
@@ -694,7 +693,7 @@ pub(super) fn type_param_predicates(
694
693
&& param_id == item_hir_id
695
694
{
696
695
let identity_trait_ref = ty:: TraitRef :: identity ( tcx, item_def_id. to_def_id ( ) ) ;
697
- extend = Some ( ( identity_trait_ref. to_predicate ( tcx) , item. span ) ) ;
696
+ extend = Some ( ( identity_trait_ref. upcast ( tcx) , item. span ) ) ;
698
697
}
699
698
700
699
let icx = ItemCtxt :: new ( tcx, item_def_id) ;
0 commit comments