about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-13 18:37:43 +0200
committerGitHub <noreply@github.com>2023-09-13 18:37:43 +0200
commit48d89a87595230599579e1cf6d2c5b3f085dd034 (patch)
treedeb1fc3f4630ef019bbc8adbca78f0e46ff489f2 /compiler/rustc_mir_transform/src
parent27c6099c7915b4d57839e1f7af93b95fd1effd8d (diff)
parent7c53e87d556f7ce878a446c9db058877ceb69d10 (diff)
Rollup merge of #115815 - bvanjoi:fix-115809, r=oli-obk
fix: return early when has tainted in mir pass

Fixes https://github.com/rust-lang/rust/issues/115809

As in #115643, `run_pass` is skipped if the body has tainted errors.

r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index ff4385e8116..70d4ea74d1a 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -606,6 +606,11 @@ fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
     let body = tcx.mir_drops_elaborated_and_const_checked(did).steal();
     let mut body = remap_mir_for_const_eval_select(tcx, body, hir::Constness::NotConst);
     debug!("body: {:#?}", body);
+
+    if body.tainted_by_errors.is_some() {
+        return body;
+    }
+
     run_optimization_passes(tcx, &mut body);
 
     body