about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/regions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_trait_selection/src/regions.rs')
-rw-r--r--compiler/rustc_trait_selection/src/regions.rs22
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,