diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-01-30 17:47:51 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-15 19:32:10 +0100 |
| commit | cebbba081e4609099df3921de8a1422b7ea52599 (patch) | |
| tree | 96784e4ada9c7d62e8890ce8bac2d4f840eba6c4 /compiler/rustc_save_analysis/src/lib.rs | |
| parent | bd3cd5dbed5f56fb44a14a20dd2113e3049d2565 (diff) | |
| download | rust-cebbba081e4609099df3921de8a1422b7ea52599.tar.gz rust-cebbba081e4609099df3921de8a1422b7ea52599.zip | |
Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
Diffstat (limited to 'compiler/rustc_save_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_save_analysis/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 129123349a0..a45406c6b04 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -201,7 +201,7 @@ impl<'tcx> SaveContext<'tcx> { } pub fn get_item_data(&self, item: &hir::Item<'_>) -> Option<Data> { - let def_id = self.tcx.hir().local_def_id(item.hir_id).to_def_id(); + let def_id = item.def_id.to_def_id(); match item.kind { hir::ItemKind::Fn(ref sig, ref generics, _) => { let qualname = format!("::{}", self.tcx.def_path_str(def_id)); @@ -290,7 +290,11 @@ impl<'tcx> SaveContext<'tcx> { span: self.span_from_span(item.ident.span), value: filename.to_string(), parent: None, - children: m.item_ids.iter().map(|i| id_from_hir_id(i.id, self)).collect(), + children: m + .item_ids + .iter() + .map(|i| id_from_def_id(i.def_id.to_def_id())) + .collect(), decl_id: None, docs: self.docs_for_attrs(&item.attrs), sig: sig::item_signature(item, self), |
