@@ -8,7 +8,7 @@ use rustc_infer::infer::InferCtxt;
8
8
use rustc_middle:: ty:: {
9
9
fold:: { BottomUpFolder , TypeFoldable , TypeFolder } ,
10
10
subst:: { GenericArg , InternalSubsts , SubstsRef } ,
11
- GenericParamDefKind , ParamEnv , Predicate , Region , TraitRef , Ty , TyCtxt ,
11
+ GenericParamDefKind , ParamEnv , Predicate , Region , TraitRef , Ty , TyCtxt , Unevaluated ,
12
12
} ;
13
13
use std:: collections:: HashMap ;
14
14
@@ -376,8 +376,8 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
376
376
predicate : Predicate < ' tcx > ,
377
377
) -> Option < Predicate < ' tcx > > {
378
378
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 ,
381
381
} ;
382
382
383
383
Some (
@@ -446,14 +446,22 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
446
446
b : r,
447
447
}
448
448
} ) ,
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) => {
450
455
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 ) )
452
457
{
453
458
// TODO: We could probably use translated version for
454
459
// `WithOptConstParam::const_param_did`
455
460
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
+ ) )
457
465
} else {
458
466
return None ;
459
467
}
0 commit comments