X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Frustc_middle%2Fsrc%2Fmir%2Fmono.rs;h=d389fa8c0ebdde82933a106cda01409431368097;hb=7907385999b4a83d37ed31d334f3ed9ca02983a1;hp=13c325a14e4023ac0ef7237421c715968875c912;hpb=7eac19c30c9aa69bc3d85a583c117c37c1579de3;p=rust.git diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index 13c325a14e4..d389fa8c0eb 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -8,7 +8,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_hir::ItemId; use rustc_index::vec::Idx; -use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext}; +use rustc_query_system::ich::StableHashingContext; use rustc_session::config::OptLevel; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; @@ -40,7 +40,7 @@ pub enum InstantiationMode { LocalCopy, } -#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)] +#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash, HashStable)] pub enum MonoItem<'tcx> { Fn(Instance<'tcx>), Static(DefId), @@ -202,26 +202,6 @@ pub fn krate(&self) -> CrateNum { } } -impl<'a, 'tcx> HashStable> for MonoItem<'tcx> { - fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { - ::std::mem::discriminant(self).hash_stable(hcx, hasher); - - match *self { - MonoItem::Fn(ref instance) => { - instance.hash_stable(hcx, hasher); - } - MonoItem::Static(def_id) => { - def_id.hash_stable(hcx, hasher); - } - MonoItem::GlobalAsm(item_id) => { - hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { - item_id.hash_stable(hcx, hasher); - }) - } - } - } -} - impl<'tcx> fmt::Display for MonoItem<'tcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { @@ -458,7 +438,7 @@ pub fn new(tcx: TyCtxt<'tcx>) -> Self { /// /// This function will build CGU names of the form: /// - /// ``` + /// ```text /// .[-in-](-)*[.] /// = . /// ```