diff options
| author | bors <bors@rust-lang.org> | 2021-02-16 22:14:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-16 22:14:32 +0000 |
| commit | 8fe989dd768f5dfdb0fc90933f3f74fa4579fefd (patch) | |
| tree | b343f190d8e1bca405fba9548778befb1986087a /compiler/rustc_codegen_ssa/src | |
| parent | a143517d44cac50b20cbd3a0b579addab40dd399 (diff) | |
| parent | 91d8e59ccaacf7df2af847037d30871ed0bd90b6 (diff) | |
| download | rust-8fe989dd768f5dfdb0fc90933f3f74fa4579fefd.tar.gz rust-8fe989dd768f5dfdb0fc90933f3f74fa4579fefd.zip | |
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mono_item.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mono_item.rs b/compiler/rustc_codegen_ssa/src/mono_item.rs index 607b5459673..8e79193759e 100644 --- a/compiler/rustc_codegen_ssa/src/mono_item.rs +++ b/compiler/rustc_codegen_ssa/src/mono_item.rs @@ -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 { |
