From e64dada56a1b687812f45ea7be86a61dff74b1c6 Mon Sep 17 00:00:00 2001 From: Miguel Guarniz Date: Sat, 11 Jun 2022 12:47:55 -0400 Subject: [PATCH] add parallelized method to apply function to each item in module Signed-off-by: Miguel Guarniz --- compiler/rustc_middle/src/hir/map/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index ebda9f7588d5d..6ff7fc085681f 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -168,6 +168,10 @@ impl<'hir> Map<'hir> { par_for_each_in(&self.tcx.hir_crate_items(()).items[..], |id| f(*id)); } + pub fn par_for_each_item_in_module(self, module: LocalDefId, f: impl Fn(ItemId) + Sync + Send) { + par_for_each_in(&self.tcx.hir_module_items(module).items[..], |id| f(*id)); + } + pub fn def_key(self, def_id: LocalDefId) -> DefKey { // Accessing the DefKey is ok, since it is part of DefPathHash. self.tcx.untracked_resolutions.definitions.def_key(def_id)