about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorThe Miri Conjob Bot <miri@cron.bot>2023-10-25 05:40:45 +0000
committerThe Miri Conjob Bot <miri@cron.bot>2023-10-25 05:40:45 +0000
commit3751fb09c36c54daecd743106314430cfb469265 (patch)
tree4b9b0d66a322460b888693d01ff6e2cc176e79c3 /compiler/rustc_interface/src
parentc612ba8e2910a585e4fc0ae126180c478b28e3de (diff)
parent2e4e2a8f288f642cafcc41fff211955ceddc453d (diff)
downloadrust-3751fb09c36c54daecd743106314430cfb469265.tar.gz
rust-3751fb09c36c54daecd743106314430cfb469265.zip
Merge from rustc
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 7a7e9024bd8..998e2686005 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -775,12 +775,16 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
     rustc_hir_analysis::check_crate(tcx)?;
 
     sess.time("MIR_borrow_checking", || {
-        tcx.hir().par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id));
+        tcx.hir().par_body_owners(|def_id| {
+            // Run THIR unsafety check because it's responsible for stealing
+            // and deallocating THIR when enabled.
+            tcx.ensure().thir_check_unsafety(def_id);
+            tcx.ensure().mir_borrowck(def_id)
+        });
     });
 
     sess.time("MIR_effect_checking", || {
         for def_id in tcx.hir().body_owners() {
-            tcx.ensure().thir_check_unsafety(def_id);
             if !tcx.sess.opts.unstable_opts.thir_unsafeck {
                 rustc_mir_transform::check_unsafety::check_unsafety(tcx, def_id);
             }