Canonicalize trait solver response inside probe

This commit is contained in:
Michael Goulet
2023-01-17 19:29:52 +00:00
parent 1f72129ffe
commit b84b1da2db
4 changed files with 25 additions and 24 deletions

View File

@@ -191,7 +191,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>,
impl_def_id: DefId,
) -> Result<Certainty, NoSolution> {
) -> QueryResult<'tcx> {
let tcx = ecx.tcx();
let goal_trait_ref = goal.predicate.projection_ty.trait_ref(tcx);
@@ -229,7 +229,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
impl_def_id
)? else {
let certainty = Certainty::Maybe(MaybeCause::Ambiguity);
return Ok(trait_ref_certainty.unify_and(certainty));
return ecx.make_canonical_response(trait_ref_certainty.unify_and(certainty));
};
if !assoc_def.item.defaultness(tcx).has_value() {
@@ -286,14 +286,14 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
let rhs_certainty =
ecx.evaluate_all(nested_goals).expect("failed to unify with unconstrained term");
Ok(trait_ref_certainty.unify_and(rhs_certainty))
ecx.make_canonical_response(trait_ref_certainty.unify_and(rhs_certainty))
})
}
fn consider_builtin_sized_candidate(
_ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
) -> Result<Certainty, NoSolution> {
) -> QueryResult<'tcx> {
bug!("`Sized` does not have an associated type: {:?}", goal);
}
@@ -301,7 +301,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
_ecx: &mut EvalCtxt<'_, 'tcx>,
_goal: Goal<'tcx, Self>,
assumption: ty::Predicate<'tcx>,
) -> Result<Certainty, NoSolution> {
) -> QueryResult<'tcx> {
if let Some(_poly_projection_pred) = assumption.to_opt_poly_projection_pred() {
unimplemented!()
} else {