Move param env bound deep normalization to OutlivesEnvironment building
This commit is contained in:
parent
48b7e38c06
commit
8e0909d98a
3 changed files with 37 additions and 45 deletions
|
@ -33,12 +33,32 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
|
|||
assumed_wf_tys: impl IntoIterator<Item = Ty<'tcx>>,
|
||||
implied_bounds_compat: bool,
|
||||
) -> Self {
|
||||
let mut bounds = vec![];
|
||||
|
||||
for bound in param_env.caller_bounds() {
|
||||
if let Some(mut type_outlives) = bound.as_type_outlives_clause() {
|
||||
if infcx.next_trait_solver() {
|
||||
match crate::solve::deeply_normalize::<_, ScrubbedTraitError<'tcx>>(
|
||||
infcx.at(&ObligationCause::dummy(), param_env),
|
||||
type_outlives,
|
||||
) {
|
||||
Ok(new) => type_outlives = new,
|
||||
Err(_) => {
|
||||
infcx.dcx().delayed_bug(format!("could not normalize `{bound}`"));
|
||||
}
|
||||
}
|
||||
}
|
||||
bounds.push(type_outlives);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: This needs to be modified so that we normalize the known type
|
||||
// outlives obligations then elaborate them into their region/type components.
|
||||
// Otherwise, `<W<'a> as Mirror>::Assoc: 'b` will not imply `'a: 'b` even
|
||||
// if we can normalize `'a`.
|
||||
OutlivesEnvironment::with_bounds(
|
||||
OutlivesEnvironment::from_normalized_bounds(
|
||||
param_env,
|
||||
bounds,
|
||||
infcx.implied_bounds_tys_with_compat(
|
||||
body_id,
|
||||
param_env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue