pub trait NormalizeExt<'tcx> {
// Required methods
fn normalize<T: TypeFoldable<TyCtxt<'tcx>>>(
&self,
value: T,
) -> InferOk<'tcx, T>;
fn deeply_normalize<T, E>(
self,
value: T,
fulfill_cx: &mut dyn TraitEngine<'tcx, E>,
) -> Result<T, Vec<E>>
where T: TypeFoldable<TyCtxt<'tcx>>,
E: FromSolverError<'tcx, NextSolverError<'tcx>>;
}
Required Methods§
sourcefn normalize<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> InferOk<'tcx, T>
fn normalize<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> InferOk<'tcx, T>
Normalize a value using the AssocTypeNormalizer
.
This normalization should be used when the type contains inference variables or the projection may be fallible.
sourcefn deeply_normalize<T, E>(
self,
value: T,
fulfill_cx: &mut dyn TraitEngine<'tcx, E>,
) -> Result<T, Vec<E>>
fn deeply_normalize<T, E>( self, value: T, fulfill_cx: &mut dyn TraitEngine<'tcx, E>, ) -> Result<T, Vec<E>>
Deeply normalizes value
, replacing all aliases which can by normalized in
the current environment. In the new solver this errors in case normalization
fails or is ambiguous.
In the old solver this simply uses normalizes
and adds the nested obligations
to the fulfill_cx
. This is necessary as we otherwise end up recomputing the
same goals in both a temporary and the shared context which negatively impacts
performance as these don’t share caching.
FIXME(-Znext-solver): For performance reasons, we currently reuse an existing
fulfillment context in the old solver. Once we have removed the old solver, we
can remove the fulfill_cx
parameter on this function.