Assert that obligations are empty before deeply normalizing

This commit is contained in:
Michael Goulet
2024-11-27 21:27:37 +00:00
parent abfa5c1dca
commit 398fd901d5
12 changed files with 37 additions and 25 deletions

View File

@@ -60,6 +60,9 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
ty: Ty<'tcx>,
) -> Result<Vec<OutlivesBound<'tcx>>, NoSolution> {
let normalize_op = |ty| -> Result<_, NoSolution> {
// We must normalize the type so we can compute the right outlives components.
// for example, if we have some constrained param type like `T: Trait<Out = U>`,
// and we know that `&'a T::Out` is WF, then we want to imply `U: 'a`.
let ty = ocx
.deeply_normalize(&ObligationCause::dummy(), param_env, ty)
.map_err(|_| NoSolution)?;