about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs b/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs
index 4004e354dc1..26ba1511b54 100644
--- a/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs
@@ -6,8 +6,7 @@ use rustc_span::{DUMMY_SP, Span};
 use tracing::{debug, instrument};
 
 use crate::traits::query::NoSolution;
-use crate::traits::query::normalize::QueryNormalizeExt;
-use crate::traits::{Normalized, ObligationCause, ObligationCtxt};
+use crate::traits::{ObligationCause, ObligationCtxt};
 
 /// This returns true if the type `ty` is "trivial" for
 /// dropck-outlives -- that is, if it doesn't require any types to
@@ -172,13 +171,18 @@ pub fn compute_dropck_outlives_inner<'tcx>(
         // do not themselves define a destructor", more or less. We have
         // to push them onto the stack to be expanded.
         for ty in constraints.dtorck_types.drain(..) {
-            let Normalized { value: ty, obligations } =
-                ocx.infcx.at(&cause, param_env).query_normalize(ty)?;
-            ocx.register_obligations(obligations);
+            let normalized_ty = ocx.normalize(&cause, param_env, ty);
 
-            debug!("dropck_outlives: ty from dtorck_types = {:?}", ty);
+            let errors = ocx.select_where_possible();
+            if !errors.is_empty() {
+                debug!("failed to normalize dtorck type: {ty} ~> {errors:#?}");
+                return Err(NoSolution);
+            }
+
+            let normalized_ty = ocx.infcx.resolve_vars_if_possible(normalized_ty);
+            debug!("dropck_outlives: ty from dtorck_types = {:?}", normalized_ty);
 
-            match ty.kind() {
+            match normalized_ty.kind() {
                 // All parameters live for the duration of the
                 // function.
                 ty::Param(..) => {}
@@ -186,12 +190,12 @@ pub fn compute_dropck_outlives_inner<'tcx>(
                 // A projection that we couldn't resolve - it
                 // might have a destructor.
                 ty::Alias(..) => {
-                    result.kinds.push(ty.into());
+                    result.kinds.push(normalized_ty.into());
                 }
 
                 _ => {
-                    if ty_set.insert(ty) {
-                        ty_stack.push((ty, depth + 1));
+                    if ty_set.insert(normalized_ty) {
+                        ty_stack.push((normalized_ty, depth + 1));
                     }
                 }
             }