about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMiguel Guarniz <mi9uel9@gmail.com>2022-06-22 19:12:18 -0400
committerMiguel Guarniz <mi9uel9@gmail.com>2022-07-13 12:22:25 -0400
commitc6e7c0514f5b581fc5f6fcebcb803a28f7b51551 (patch)
treed2ad33868286d775b07a0895ca268ddbe54792de /compiler
parente11862f811990cda65dceab96adc67c3a2096aa5 (diff)
downloadrust-c6e7c0514f5b581fc5f6fcebcb803a28f7b51551.tar.gz
rust-c6e7c0514f5b581fc5f6fcebcb803a28f7b51551.zip
use gathered body_owners in par_body_owners
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_middle/src/hir/map/mod.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs
index ff71d16f83b..eef639e1589 100644
--- a/compiler/rustc_middle/src/hir/map/mod.rs
+++ b/compiler/rustc_middle/src/hir/map/mod.rs
@@ -498,19 +498,8 @@ impl<'hir> Map<'hir> {
 
     pub fn par_body_owners<F: Fn(LocalDefId) + Sync + Send>(self, f: F) {
         use rustc_data_structures::sync::{par_iter, ParallelIterator};
-        #[cfg(parallel_compiler)]
-        use rustc_rayon::iter::IndexedParallelIterator;
-
-        par_iter(&self.krate().owners.raw).enumerate().for_each(|(owner, owner_info)| {
-            let owner = LocalDefId::new(owner);
-            if let MaybeOwner::Owner(owner_info) = owner_info {
-                par_iter(owner_info.nodes.bodies.range(..)).for_each(|(local_id, _)| {
-                    let hir_id = HirId { owner, local_id: *local_id };
-                    let body_id = BodyId { hir_id };
-                    f(self.body_owner_def_id(body_id))
-                })
-            }
-        });
+
+        par_iter(&self.tcx.hir_crate_items(()).body_owners[..]).for_each(|&def_id| f(def_id));
     }
 
     pub fn ty_param_owner(self, def_id: LocalDefId) -> LocalDefId {