about summary refs log tree commit diff
path: root/compiler/rustc_save_analysis
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-25 11:11:02 +0000
committerbors <bors@rust-lang.org>2021-07-25 11:11:02 +0000
commit6489ee10410f7be70dbefad322d1a3e1533ab282 (patch)
tree79e33e87955dfb85756c97f4854866c9a608ef17 /compiler/rustc_save_analysis
parent71a6c7c80398143a67e27b01412f4b2ec12bde8b (diff)
parentf798510d02005c2bbb1269c384c321918c578f74 (diff)
downloadrust-6489ee10410f7be70dbefad322d1a3e1533ab282.tar.gz
rust-6489ee10410f7be70dbefad322d1a3e1533ab282.zip
Auto merge of #83723 - cjgillot:ownernode, r=petrochenkov
Store all HIR owners in the same container

This replaces the previous storage in a BTreeMap for each of Item/ImplItem/TraitItem/ForeignItem.
This should allow for a more compact storage.

Based on https://github.com/rust-lang/rust/pull/83114
Diffstat (limited to 'compiler/rustc_save_analysis')
-rw-r--r--compiler/rustc_save_analysis/src/dump_visitor.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs
index 842f7f9deee..4f8dc7d16d4 100644
--- a/compiler/rustc_save_analysis/src/dump_visitor.rs
+++ b/compiler/rustc_save_analysis/src/dump_visitor.rs
@@ -146,7 +146,7 @@ impl<'tcx> DumpVisitor<'tcx> {
             },
             crate_root: crate_root.unwrap_or_else(|| "<no source>".to_owned()),
             external_crates: self.save_ctxt.get_external_crates(),
-            span: self.span_from_span(krate.item.inner),
+            span: self.span_from_span(krate.module().inner),
         };
 
         self.dumper.crate_prelude(data);
@@ -1092,11 +1092,12 @@ impl<'tcx> DumpVisitor<'tcx> {
             format!("::{}", self.tcx.def_path_str(self.tcx.hir().local_def_id(id).to_def_id()));
 
         let sm = self.tcx.sess.source_map();
-        let filename = sm.span_to_filename(krate.item.inner);
+        let krate_mod = krate.module();
+        let filename = sm.span_to_filename(krate_mod.inner);
         let data_id = id_from_hir_id(id, &self.save_ctxt);
         let children =
-            krate.item.item_ids.iter().map(|i| id_from_def_id(i.def_id.to_def_id())).collect();
-        let span = self.span_from_span(krate.item.inner);
+            krate_mod.item_ids.iter().map(|i| id_from_def_id(i.def_id.to_def_id())).collect();
+        let span = self.span_from_span(krate_mod.inner);
         let attrs = self.tcx.hir().attrs(id);
 
         self.dumper.dump_def(