1
Fork 0

Auto merge of #81611 - cjgillot:meowner, r=estebank

Only store a LocalDefId in some HIR nodes

Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef.
As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`.

This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
This commit is contained in:
bors 2021-02-16 22:14:32 +00:00
commit 8fe989dd76
117 changed files with 1127 additions and 1191 deletions

View file

@ -30,8 +30,8 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
MonoItem::Static(def_id) => {
cx.codegen_static(def_id, cx.tcx().is_mutable_static(def_id));
}
MonoItem::GlobalAsm(hir_id) => {
let item = cx.tcx().hir().expect_item(hir_id);
MonoItem::GlobalAsm(item_id) => {
let item = cx.tcx().hir().item(item_id);
if let hir::ItemKind::GlobalAsm(ref ga) = item.kind {
cx.codegen_global_asm(ga);
} else {