diff options
| author | Michael Goulet <michael@errs.io> | 2025-01-25 16:20:23 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-01-28 19:11:05 +0000 |
| commit | 8e0909d98a8e467f79d80000fe57eee6417ac02e (patch) | |
| tree | e8ade4aa95da4ef2436539f0ac53d49336b303c4 /compiler/rustc_trait_selection/src/regions.rs | |
| parent | 48b7e38c0607e856dbbb932e60ecc85e45a1427d (diff) | |
| download | rust-8e0909d98a8e467f79d80000fe57eee6417ac02e.tar.gz rust-8e0909d98a8e467f79d80000fe57eee6417ac02e.zip | |
Move param env bound deep normalization to OutlivesEnvironment building
Diffstat (limited to 'compiler/rustc_trait_selection/src/regions.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/regions.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/regions.rs b/compiler/rustc_trait_selection/src/regions.rs index fc9fa44b4c6..55171754618 100644 --- a/compiler/rustc_trait_selection/src/regions.rs +++ b/compiler/rustc_trait_selection/src/regions.rs @@ -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, |
