1
Fork 0

Rollup merge of #120513 - compiler-errors:normalize-regions-for-nll, r=lcnr

Normalize type outlives obligations in NLL for new solver

Normalize the type outlives assumptions and obligations in MIR borrowck. This should fix any of the lazy-norm-related MIR borrowck problems.

Also some cleanups from last PR:
1. Normalize obligations in a loop in lexical region resolution
2. Use `deeply_normalize_with_skipped_universes` in lexical resolution since we may have, e.g. `for<'a> Alias<'a>: 'b`.

r? lcnr
This commit is contained in:
Matthias Krüger 2024-02-06 22:45:43 +01:00 committed by GitHub
commit 012ce8ae98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 248 additions and 92 deletions

View file

@ -1,5 +1,6 @@
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{InferCtxt, RegionResolutionError};
use rustc_middle::traits::query::NoSolution;
use rustc_middle::traits::ObligationCause;
pub trait InferCtxtRegionExt<'tcx> {
@ -31,7 +32,7 @@ impl<'tcx> InferCtxtRegionExt<'tcx> for InferCtxt<'tcx> {
),
ty,
)
.map_err(|_| ty)
.map_err(|_| NoSolution)
} else {
Ok(ty)
}

View file

@ -179,7 +179,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
}
let outlives_env = OutlivesEnvironment::new(full_env);
let _ = infcx.process_registered_region_obligations::<!>(&outlives_env, |ty, _| Ok(ty));
let _ = infcx.process_registered_region_obligations(&outlives_env, |ty, _| Ok(ty));
let region_data =
infcx.inner.borrow_mut().unwrap_region_constraints().region_constraint_data().clone();