Fix replacing supertrait aliases in ReplaceProjectionWith

This commit is contained in:
Michael Goulet
2025-04-16 19:47:56 +00:00
parent c6aad02ddb
commit 3863018d96
10 changed files with 238 additions and 68 deletions

View File

@@ -92,16 +92,20 @@ where
let ty::Dynamic(bounds, _, _) = goal.predicate.self_ty().kind() else {
panic!("expected object type in `probe_and_consider_object_bound_candidate`");
};
ecx.add_goals(
GoalSource::ImplWhereBound,
structural_traits::predicates_for_object_candidate(
ecx,
goal.param_env,
goal.predicate.trait_ref(cx),
bounds,
),
);
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
match structural_traits::predicates_for_object_candidate(
ecx,
goal.param_env,
goal.predicate.trait_ref(cx),
bounds,
) {
Ok(requirements) => {
ecx.add_goals(GoalSource::ImplWhereBound, requirements);
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}
Err(_) => {
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
}
}
})
}