diff options
| author | Wilco Kusee <wilcokusee@gmail.com> | 2023-02-01 17:13:57 +0100 |
|---|---|---|
| committer | Wilco Kusee <wilcokusee@gmail.com> | 2023-02-01 17:15:12 +0100 |
| commit | de50a86a12d6db76e7fec4c8f15e17ae199acb7e (patch) | |
| tree | cd9553b3d0ad07cd1ad6425d1e79ae964401a352 | |
| parent | 5fd4f5bceb456bd3681381bb390562466fdc4356 (diff) | |
| download | rust-de50a86a12d6db76e7fec4c8f15e17ae199acb7e.tar.gz rust-de50a86a12d6db76e7fec4c8f15e17ae199acb7e.zip | |
Simplify discriminant_kind goal using new helper function
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/project_goals.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/project_goals.rs b/compiler/rustc_trait_selection/src/solve/project_goals.rs index 48627ee6096..170b560d7b6 100644 --- a/compiler/rustc_trait_selection/src/solve/project_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/project_goals.rs @@ -586,20 +586,13 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> { ecx: &mut EvalCtxt<'_, 'tcx>, goal: Goal<'tcx, Self>, ) -> QueryResult<'tcx> { - let self_ty = goal.predicate.self_ty(); - - let tcx = ecx.tcx(); - let term = self_ty.discriminant_ty(tcx).into(); - - Self::consider_assumption( - ecx, - goal, - ty::Binder::dummy(ty::ProjectionPredicate { - projection_ty: tcx.mk_alias_ty(goal.predicate.def_id(), [self_ty]), - term, - }) - .to_predicate(tcx), - ) + let discriminant = goal.predicate.self_ty().discriminant_ty(ecx.tcx()); + let nested_goals = ecx.infcx.eq( + goal.param_env, + goal.predicate.term.ty().expect("expected ty goal"), + discriminant, + )?; + ecx.evaluate_all_and_make_canonical_response(nested_goals) } } |
