@@ -8,7 +8,7 @@ use rustc_infer::infer::InferCtxt;
88use rustc_middle:: ty:: {
99 fold:: { BottomUpFolder , TypeFoldable , TypeFolder } ,
1010 subst:: { GenericArg , InternalSubsts , SubstsRef } ,
11- GenericParamDefKind , ParamEnv , Predicate , Region , TraitRef , Ty , TyCtxt ,
11+ GenericParamDefKind , ParamEnv , Predicate , Region , TraitRef , Ty , TyCtxt , Unevaluated ,
1212} ;
1313use std:: collections:: HashMap ;
1414
@@ -376,8 +376,8 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
376376 predicate : Predicate < ' tcx > ,
377377 ) -> Option < Predicate < ' tcx > > {
378378 use rustc_middle:: ty:: {
379- OutlivesPredicate , PredicateKind , ProjectionPredicate , ProjectionTy , SubtypePredicate ,
380- ToPredicate , TraitPredicate , WithOptConstParam ,
379+ CoercePredicate , OutlivesPredicate , PredicateKind , ProjectionPredicate , ProjectionTy ,
380+ SubtypePredicate , ToPredicate , TraitPredicate , WithOptConstParam ,
381381 } ;
382382
383383 Some (
@@ -446,14 +446,22 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
446446 b : r,
447447 }
448448 } ) ,
449- PredicateKind :: ConstEvaluatable ( param, orig_substs) => {
449+ PredicateKind :: Coerce ( pred) => PredicateKind :: Coerce ( {
450+ let a = self . translate ( index_map, pred. a ) ;
451+ let b = self . translate ( index_map, pred. b ) ;
452+ CoercePredicate { a, b }
453+ } ) ,
454+ PredicateKind :: ConstEvaluatable ( uv) => {
450455 if let Some ( ( target_def_id, target_substs) ) =
451- self . translate_orig_substs ( index_map, param . did , orig_substs )
456+ self . translate_orig_substs ( index_map, uv . def . did , uv . substs ( self . tcx ) )
452457 {
453458 // TODO: We could probably use translated version for
454459 // `WithOptConstParam::const_param_did`
455460 let const_param = WithOptConstParam :: unknown ( target_def_id) ;
456- PredicateKind :: ConstEvaluatable ( const_param, target_substs)
461+ PredicateKind :: ConstEvaluatable ( Unevaluated :: new (
462+ const_param,
463+ target_substs,
464+ ) )
457465 } else {
458466 return None ;
459467 }
0 commit comments