about summary refs log tree commit diff
path: root/compiler/rustc_hir/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-24 06:51:17 +0000
committerbors <bors@rust-lang.org>2021-01-24 06:51:17 +0000
commit85e355ea9bd86ac6580a5d422a65dbf689845808 (patch)
tree2c849754899ea52c67b42163e413cfcaf3050426 /compiler/rustc_hir/src
parent446cbc9db080c63c8742c418bcaa44c808f7e033 (diff)
parent97ee7c7e5ab5b70453920e105530dd8a2a4391d9 (diff)
downloadrust-85e355ea9bd86ac6580a5d422a65dbf689845808.tar.gz
rust-85e355ea9bd86ac6580a5d422a65dbf689845808.zip
Auto merge of #80919 - cjgillot:defkey-span, r=oli-obk
Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N

Sample from #80347.
Diffstat (limited to 'compiler/rustc_hir/src')
-rw-r--r--compiler/rustc_hir/src/definitions.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs
index d5ade86593e..6a1b9bdbb94 100644
--- a/compiler/rustc_hir/src/definitions.rs
+++ b/compiler/rustc_hir/src/definitions.rs
@@ -419,6 +419,10 @@ impl Definitions {
     pub fn add_parent_module_of_macro_def(&mut self, expn_id: ExpnId, module: DefId) {
         self.parent_modules_of_macro_defs.insert(expn_id, module);
     }
+
+    pub fn iter_local_def_id(&self) -> impl Iterator<Item = LocalDefId> + '_ {
+        self.def_id_to_hir_id.iter_enumerated().map(|(k, _)| k)
+    }
 }
 
 #[derive(Copy, Clone, PartialEq, Debug)]