about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-16 12:54:18 +0000
committerbors <bors@rust-lang.org>2025-05-16 12:54:18 +0000
commitfc6bfe09aa946afae36b1964512a818156a8e781 (patch)
tree149fb7b24473283591f679598512b050b2f6d3bc /compiler/rustc_interface/src
parent1b9efcd18f1cb95348c3ffadd4db47bfa15292e5 (diff)
parent34976ac9fe6bd46ca02631512a27cb8995b2c1ac (diff)
downloadrust-fc6bfe09aa946afae36b1964512a818156a8e781.tar.gz
rust-fc6bfe09aa946afae36b1964512a818156a8e781.zip
Auto merge of #140959 - oli-obk:no-unsafe-children, r=davidtwco
Invoke a query only when it doesn't return immediately anyway

This should cause less query key caching and less dep graph data, hopefully resulting in some perf improvements
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 7ed32d559c3..b554cc715fe 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -996,10 +996,9 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
 
     sess.time("MIR_borrow_checking", || {
         tcx.par_hir_body_owners(|def_id| {
-            // Run unsafety check because it's responsible for stealing and
-            // deallocating THIR.
-            tcx.ensure_ok().check_unsafety(def_id);
             if !tcx.is_typeck_child(def_id.to_def_id()) {
+                // Child unsafety and borrowck happens together with the parent
+                tcx.ensure_ok().check_unsafety(def_id);
                 tcx.ensure_ok().mir_borrowck(def_id)
             }
         });