@@ -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 } ;
@@ -42,7 +42,7 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
42
42
43
43
result. predicates =
44
44
tcx. arena . alloc_from_iter ( result. predicates . iter ( ) . copied ( ) . chain ( std:: iter:: once ( (
45
- ty:: TraitRef :: identity ( tcx, def_id) . to_predicate ( tcx) ,
45
+ ty:: TraitRef :: identity ( tcx, def_id) . upcast ( tcx) ,
46
46
span,
47
47
) ) ) ) ;
48
48
}
@@ -165,7 +165,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
165
165
// (see below). Recall that a default impl is not itself an impl, but rather a
166
166
// set of defaults that can be incorporated into another impl.
167
167
if let Some ( trait_ref) = is_default_impl_trait {
168
- predicates. insert ( ( trait_ref. to_predicate ( tcx) , tcx. def_span ( def_id) ) ) ;
168
+ predicates. insert ( ( trait_ref. upcast ( tcx) , tcx. def_span ( def_id) ) ) ;
169
169
}
170
170
171
171
// Collect the predicates that were written inline by the user on each
@@ -197,7 +197,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
197
197
. expect ( "const parameters cannot be generic" ) ;
198
198
let ct = icx. lowerer ( ) . lower_const_param ( param. hir_id , ct_ty) ;
199
199
predicates. insert ( (
200
- ty:: ClauseKind :: ConstArgHasType ( ct, ct_ty) . to_predicate ( tcx) ,
200
+ ty:: ClauseKind :: ConstArgHasType ( ct, ct_ty) . upcast ( tcx) ,
201
201
param. span ,
202
202
) ) ;
203
203
}
@@ -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
@@ -258,7 +258,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
258
258
}
259
259
} ;
260
260
let pred = ty:: ClauseKind :: RegionOutlives ( ty:: OutlivesPredicate ( r1, r2) )
261
- . to_predicate ( tcx) ;
261
+ . 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
}
@@ -355,7 +355,7 @@ fn const_evaluatable_predicates_of(
355
355
if let ty:: ConstKind :: Unevaluated ( _) = ct. kind ( ) {
356
356
let span = self . tcx . def_span ( c. def_id ) ;
357
357
self . preds
358
- . insert ( ( ty:: ClauseKind :: ConstEvaluatable ( ct) . to_predicate ( self . tcx ) , span) ) ;
358
+ . insert ( ( ty:: ClauseKind :: ConstEvaluatable ( ct) . upcast ( self . tcx ) , span) ) ;
359
359
}
360
360
}
361
361
@@ -694,7 +694,7 @@ pub(super) fn type_param_predicates(
694
694
&& param_id == item_hir_id
695
695
{
696
696
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 ) ) ;
697
+ extend = Some ( ( identity_trait_ref. upcast ( tcx) , item. span ) ) ;
698
698
}
699
699
700
700
let icx = ItemCtxt :: new ( tcx, item_def_id) ;
0 commit comments