Auto merge of #95656 - cjgillot:no-id-hashing-mode, r=Aaron1011
Remove NodeIdHashingMode. r? `@ghost`
This commit is contained in:
commit
f38c5c8e5d
20 changed files with 84 additions and 388 deletions
|
@ -5,7 +5,7 @@
|
|||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use std::hash::Hash;
|
||||
|
||||
|
@ -58,9 +58,7 @@ impl<Id> Default for AccessLevels<Id> {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for AccessLevels {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
let AccessLevels { ref map } = *self;
|
||||
map.hash_stable(hcx, hasher);
|
||||
});
|
||||
let AccessLevels { ref map } = *self;
|
||||
map.hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::fmt;
|
||||
|
@ -446,10 +446,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
|
|||
ref yield_in_scope,
|
||||
} = *self;
|
||||
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
root_body.hash_stable(hcx, hasher)
|
||||
});
|
||||
|
||||
root_body.hash_stable(hcx, hasher);
|
||||
body_expr_count.hash_stable(hcx, hasher);
|
||||
parent_map.hash_stable(hcx, hasher);
|
||||
var_map.hash_stable(hcx, hasher);
|
||||
|
|
|
@ -8,7 +8,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
|||
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 @@ impl<'tcx> MonoItem<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> 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 {
|
||||
|
|
|
@ -47,7 +47,7 @@ use rustc_hir::{
|
|||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_middle::mir::FakeReadCause;
|
||||
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
|
||||
use rustc_session::config::{BorrowckMode, CrateType, OutputFilenames};
|
||||
use rustc_session::lint::{Level, Lint};
|
||||
|
@ -367,7 +367,7 @@ pub struct GeneratorInteriorTypeCause<'tcx> {
|
|||
pub expr: Option<hir::HirId>,
|
||||
}
|
||||
|
||||
#[derive(TyEncodable, TyDecodable, Debug)]
|
||||
#[derive(TyEncodable, TyDecodable, Debug, HashStable)]
|
||||
pub struct TypeckResults<'tcx> {
|
||||
/// The `HirId::owner` all `ItemLocalId`s in this table are relative to.
|
||||
pub hir_owner: LocalDefId,
|
||||
|
@ -783,62 +783,6 @@ impl<'tcx> TypeckResults<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let ty::TypeckResults {
|
||||
hir_owner,
|
||||
ref type_dependent_defs,
|
||||
ref field_indices,
|
||||
ref user_provided_types,
|
||||
ref user_provided_sigs,
|
||||
ref node_types,
|
||||
ref node_substs,
|
||||
ref adjustments,
|
||||
ref pat_binding_modes,
|
||||
ref pat_adjustments,
|
||||
ref closure_kind_origins,
|
||||
ref liberated_fn_sigs,
|
||||
ref fru_field_types,
|
||||
ref coercion_casts,
|
||||
ref used_trait_imports,
|
||||
tainted_by_errors,
|
||||
ref concrete_opaque_types,
|
||||
ref closure_min_captures,
|
||||
ref closure_fake_reads,
|
||||
ref generator_interior_types,
|
||||
ref treat_byte_string_as_slice,
|
||||
ref closure_size_eval,
|
||||
} = *self;
|
||||
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
hcx.local_def_path_hash(hir_owner);
|
||||
|
||||
type_dependent_defs.hash_stable(hcx, hasher);
|
||||
field_indices.hash_stable(hcx, hasher);
|
||||
user_provided_types.hash_stable(hcx, hasher);
|
||||
user_provided_sigs.hash_stable(hcx, hasher);
|
||||
node_types.hash_stable(hcx, hasher);
|
||||
node_substs.hash_stable(hcx, hasher);
|
||||
adjustments.hash_stable(hcx, hasher);
|
||||
pat_binding_modes.hash_stable(hcx, hasher);
|
||||
pat_adjustments.hash_stable(hcx, hasher);
|
||||
|
||||
closure_kind_origins.hash_stable(hcx, hasher);
|
||||
liberated_fn_sigs.hash_stable(hcx, hasher);
|
||||
fru_field_types.hash_stable(hcx, hasher);
|
||||
coercion_casts.hash_stable(hcx, hasher);
|
||||
used_trait_imports.hash_stable(hcx, hasher);
|
||||
tainted_by_errors.hash_stable(hcx, hasher);
|
||||
concrete_opaque_types.hash_stable(hcx, hasher);
|
||||
closure_min_captures.hash_stable(hcx, hasher);
|
||||
closure_fake_reads.hash_stable(hcx, hasher);
|
||||
generator_interior_types.hash_stable(hcx, hasher);
|
||||
treat_byte_string_as_slice.hash_stable(hcx, hasher);
|
||||
closure_size_eval.hash_stable(hcx, hasher);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rustc_index::newtype_index! {
|
||||
pub struct UserTypeAnnotationIndex {
|
||||
derive [HashStable]
|
||||
|
|
|
@ -18,7 +18,6 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::NodeIdHashingMode;
|
||||
use rustc_span::{sym, DUMMY_SP};
|
||||
use rustc_target::abi::{Integer, Size, TargetDataLayout};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -136,11 +135,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
// regions, which is desirable too.
|
||||
let ty = self.erase_regions(ty);
|
||||
|
||||
hcx.while_hashing_spans(false, |hcx| {
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
ty.hash_stable(hcx, &mut hasher);
|
||||
});
|
||||
});
|
||||
hcx.while_hashing_spans(false, |hcx| ty.hash_stable(hcx, &mut hasher));
|
||||
hasher.finish()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue