about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits/query
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-05-12 14:22:48 +0000
committerMichael Goulet <michael@errs.io>2025-05-12 21:04:38 +0000
commitdf1da673f75937a1a8ebd4ad09b5ffb244df6927 (patch)
treea6e44c05630f0ea664e21a4b092bc5b1d85466e7 /compiler/rustc_trait_selection/src/traits/query
parent1a7f290a9aedc138edf9c88a82019292019754d9 (diff)
downloadrust-df1da673f75937a1a8ebd4ad09b5ffb244df6927.tar.gz
rust-df1da673f75937a1a8ebd4ad09b5ffb244df6927.zip
Flush errors before deep normalize in dropck_outlives
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/query')
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs8
1 files changed, 8 insertions, 0 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 f04a5feba30..c82d5ca59ef 100644
--- a/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs
@@ -196,6 +196,14 @@ where
                 debug!("dropck_outlives: ty from dtorck_types = {:?}", ty);
                 ty
             } else {
+                // Flush errors b/c `deeply_normalize` doesn't expect pending
+                // obligations, and we may have pending obligations from the
+                // branch above (from other types).
+                let errors = ocx.select_all_or_error();
+                if !errors.is_empty() {
+                    return Err(errors);
+                }
+
                 ocx.deeply_normalize(&cause, param_env, ty)?;
 
                 let errors = ocx.select_where_possible();