add deep normalization via the new solver
This commit is contained in:
parent
4d42de6d1b
commit
42067596c2
6 changed files with 281 additions and 6 deletions
|
@ -30,7 +30,7 @@ pub trait QueryNormalizeExt<'tcx> {
|
|||
///
|
||||
/// After codegen, when lifetimes do not matter, it is preferable to instead
|
||||
/// use [`TyCtxt::normalize_erasing_regions`], which wraps this procedure.
|
||||
fn query_normalize<T>(&self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
fn query_normalize<T>(self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
where
|
||||
T: TypeFoldable<TyCtxt<'tcx>>;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ impl<'cx, 'tcx> QueryNormalizeExt<'tcx> for At<'cx, 'tcx> {
|
|||
/// normalizing, but for now should be used only when we actually
|
||||
/// know that normalization will succeed, since error reporting
|
||||
/// and other details are still "under development".
|
||||
fn query_normalize<T>(&self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
fn query_normalize<T>(self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
where
|
||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||
{
|
||||
|
@ -60,6 +60,16 @@ impl<'cx, 'tcx> QueryNormalizeExt<'tcx> for At<'cx, 'tcx> {
|
|||
self.param_env,
|
||||
self.cause,
|
||||
);
|
||||
|
||||
if self.infcx.next_trait_solver() {
|
||||
match crate::solve::deeply_normalize(self, value) {
|
||||
Ok(value) => return Ok(Normalized { value, obligations: vec![] }),
|
||||
Err(_errors) => {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !needs_normalization(&value, self.param_env.reveal()) {
|
||||
return Ok(Normalized { value, obligations: vec![] });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue