about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2025-04-04 09:58:55 +0000
committerMatthew Jasper <mjjasper1@gmail.com>2025-04-11 16:31:28 +0000
commitac45a672979b28670cf2e5de5afbb0b1fb42c0b2 (patch)
tree11e18fa896aaa48199a3fd8d9f6c77172cf1c992 /compiler/rustc_mir_transform
parent71b68da1bd9fa6afb9f964a731e9c843ab0862bd (diff)
Use delayed bug for normalization errors in drop elaboration
Normalization can fail from errors from other items so use a delayed
bug instead of checking the body.
Diffstat (limited to 'compiler/rustc_mir_transform')
-rw-r--r--compiler/rustc_mir_transform/src/elaborate_drop.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_mir_transform/src/elaborate_drop.rs b/compiler/rustc_mir_transform/src/elaborate_drop.rs
index 0d8cf524661..fa476f96123 100644
--- a/compiler/rustc_mir_transform/src/elaborate_drop.rs
+++ b/compiler/rustc_mir_transform/src/elaborate_drop.rs
@@ -266,19 +266,16 @@ where
                 let tcx = self.tcx();
 
                 assert_eq!(self.elaborator.typing_env().typing_mode, ty::TypingMode::PostAnalysis);
-                // The type error for normalization may have been in dropck: see
-                // `compute_drop_data` in rustc_borrowck, in which case we wouldn't have
-                // deleted the MIR body and could have an error here as well.
                 let field_ty = match tcx
                     .try_normalize_erasing_regions(self.elaborator.typing_env(), f.ty(tcx, args))
                 {
                     Ok(t) => t,
                     Err(_) => Ty::new_error(
                         self.tcx(),
-                        self.elaborator
-                            .body()
-                            .tainted_by_errors
-                            .expect("Error in drop elaboration not found by dropck."),
+                        self.tcx().dcx().span_delayed_bug(
+                            self.elaborator.body().span,
+                            "Error normalizing in drop elaboration.",
+                        ),
                     ),
                 };