1
Fork 0

Deeply normalize obligations in refining_impl_trait

This commit is contained in:
Michael Goulet 2024-02-28 16:09:06 +00:00
parent ef324565d0
commit 75e15f7cf4
3 changed files with 38 additions and 5 deletions

View file

@ -136,11 +136,15 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
// 1. Project the RPITIT projections from the trait to the opaques on the impl,
// which means that they don't need to be mapped manually.
//
// 2. Project any other projections that show up in the bound. That makes sure that
// we don't consider `tests/ui/async-await/in-trait/async-associated-types.rs`
// to be refining.
let (trait_bounds, impl_bounds) =
ocx.normalize(&ObligationCause::dummy(), param_env, (trait_bounds, impl_bounds));
// 2. Deeply normalize any other projections that show up in the bound. That makes sure
// that we don't consider `tests/ui/async-await/in-trait/async-associated-types.rs`
// or `tests/ui/impl-trait/in-trait/refine-normalize.rs` to be refining.
let Ok((trait_bounds, impl_bounds)) =
ocx.deeply_normalize(&ObligationCause::dummy(), param_env, (trait_bounds, impl_bounds))
else {
tcx.dcx().delayed_bug("encountered errors when checking RPITIT refinement (selection)");
return;
};
// Since we've normalized things, we need to resolve regions, since we'll
// possibly have introduced region vars during projection. We don't expect