Simplify discriminant_kind goal using new helper function
This commit is contained in:
parent
5fd4f5bceb
commit
de50a86a12
1 changed files with 7 additions and 14 deletions
|
@ -586,20 +586,13 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
||||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||||
goal: Goal<'tcx, Self>,
|
goal: Goal<'tcx, Self>,
|
||||||
) -> QueryResult<'tcx> {
|
) -> QueryResult<'tcx> {
|
||||||
let self_ty = goal.predicate.self_ty();
|
let discriminant = goal.predicate.self_ty().discriminant_ty(ecx.tcx());
|
||||||
|
let nested_goals = ecx.infcx.eq(
|
||||||
let tcx = ecx.tcx();
|
goal.param_env,
|
||||||
let term = self_ty.discriminant_ty(tcx).into();
|
goal.predicate.term.ty().expect("expected ty goal"),
|
||||||
|
discriminant,
|
||||||
Self::consider_assumption(
|
)?;
|
||||||
ecx,
|
ecx.evaluate_all_and_make_canonical_response(nested_goals)
|
||||||
goal,
|
|
||||||
ty::Binder::dummy(ty::ProjectionPredicate {
|
|
||||||
projection_ty: tcx.mk_alias_ty(goal.predicate.def_id(), [self_ty]),
|
|
||||||
term,
|
|
||||||
})
|
|
||||||
.to_predicate(tcx),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue