diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-01-30 19:18:48 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-15 19:24:58 +0100 |
| commit | bd3cd5dbed5f56fb44a14a20dd2113e3049d2565 (patch) | |
| tree | 83063aac7f1834f2bb10070fdfc42fa3787f4d31 /compiler/rustc_middle/src | |
| parent | c676e358a506af3f97025fa248343552bddc57d9 (diff) | |
| download | rust-bd3cd5dbed5f56fb44a14a20dd2113e3049d2565.tar.gz rust-bd3cd5dbed5f56fb44a14a20dd2113e3049d2565.zip | |
Use an ItemId inside mir::GlobalAsm.
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/mono.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index eb13c89544c..a4b641ef83a 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -7,7 +7,7 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; -use rustc_hir::HirId; +use rustc_hir::{HirId, ItemId}; use rustc_session::config::OptLevel; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; @@ -43,7 +43,7 @@ pub enum InstantiationMode { pub enum MonoItem<'tcx> { Fn(Instance<'tcx>), Static(DefId), - GlobalAsm(HirId), + GlobalAsm(ItemId), } impl<'tcx> MonoItem<'tcx> { @@ -71,8 +71,8 @@ impl<'tcx> MonoItem<'tcx> { match *self { MonoItem::Fn(instance) => tcx.symbol_name(instance), MonoItem::Static(def_id) => tcx.symbol_name(Instance::mono(tcx, def_id)), - MonoItem::GlobalAsm(hir_id) => { - let def_id = tcx.hir().local_def_id(hir_id); + MonoItem::GlobalAsm(item_id) => { + let def_id = tcx.hir().local_def_id(item_id.hir_id()); SymbolName::new(tcx, &format!("global_asm_{:?}", def_id)) } } @@ -178,7 +178,7 @@ impl<'tcx> MonoItem<'tcx> { MonoItem::Static(def_id) => { def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)) } - MonoItem::GlobalAsm(hir_id) => Some(hir_id), + MonoItem::GlobalAsm(item_id) => Some(item_id.hir_id()), } .map(|hir_id| tcx.hir().span(hir_id)) } @@ -195,9 +195,9 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx> { MonoItem::Static(def_id) => { def_id.hash_stable(hcx, hasher); } - MonoItem::GlobalAsm(node_id) => { + MonoItem::GlobalAsm(item_id) => { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { - node_id.hash_stable(hcx, hasher); + item_id.hash_stable(hcx, hasher); }) } } @@ -351,7 +351,7 @@ impl<'tcx> CodegenUnit<'tcx> { MonoItem::Static(def_id) => { def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)) } - MonoItem::GlobalAsm(hir_id) => Some(hir_id), + MonoItem::GlobalAsm(item_id) => Some(item_id.hir_id()), }, item.symbol_name(tcx), ) |
