Prepopulate opaques in canonical input

This commit is contained in:
Michael Goulet 2023-05-16 23:51:23 +00:00
parent a2d7ffc635
commit f3c9c21658
11 changed files with 243 additions and 81 deletions

View file

@ -333,8 +333,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
candidates: &mut Vec<Candidate<'tcx>>,
) {
let tcx = self.tcx();
// FIXME: We also have to normalize opaque types, not sure where to best fit that in.
let &ty::Alias(ty::Projection, projection_ty) = goal.predicate.self_ty().kind() else {
let &ty::Alias(_, projection_ty) = goal.predicate.self_ty().kind() else {
return
};
@ -356,8 +355,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}),
);
ecx.add_goal(normalizes_to_goal);
let _ = ecx.try_evaluate_added_goals()?;
let _ = ecx.try_evaluate_added_goals().inspect_err(|_| {
debug!("self type normalization failed");
})?;
let normalized_ty = ecx.resolve_vars_if_possible(normalized_ty);
debug!(?normalized_ty, "self type normalized");
// NOTE: Alternatively we could call `evaluate_goal` here and only
// have a `Normalized` candidate. This doesn't work as long as we
// use `CandidateSource` in winnowing.