Allow escaping bound vars during normalize_erasing_regions in new solver

This commit is contained in:
Michael Goulet 2023-07-13 18:24:37 +00:00
parent bacf5bcbc7
commit 4bcca3294a
4 changed files with 51 additions and 22 deletions

View file

@ -19,9 +19,19 @@ use super::FulfillmentCtxt;
pub(crate) fn deeply_normalize<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
at: At<'_, 'tcx>,
value: T,
) -> Result<T, Vec<FulfillmentError<'tcx>>> {
deeply_normalize_with_skipped_universes(at, value, vec![])
}
/// Deeply normalize all aliases in `value`. This does not handle inference and expects
/// its input to be already fully resolved.
pub(crate) fn deeply_normalize_with_skipped_universes<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
at: At<'_, 'tcx>,
value: T,
universes: Vec<Option<UniverseIndex>>,
) -> Result<T, Vec<FulfillmentError<'tcx>>> {
let fulfill_cx = FulfillmentCtxt::new(at.infcx);
let mut folder = NormalizationFolder { at, fulfill_cx, depth: 0, universes: Vec::new() };
let mut folder = NormalizationFolder { at, fulfill_cx, depth: 0, universes };
value.try_fold_with(&mut folder)
}