Move ICH to rustc_query_system.
This commit is contained in:
parent
2d38c53767
commit
c355b2e5cd
11 changed files with 30 additions and 39 deletions
|
@ -4308,13 +4308,17 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"rustc-rayon-core",
|
||||
"rustc_arena",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
"rustc_hir",
|
||||
"rustc_index",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
|
5
compiler/rustc_middle/src/ich.rs
Normal file
5
compiler/rustc_middle/src/ich.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
//! ICH - Incremental Compilation Hash
|
||||
|
||||
pub use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
|
||||
mod impls_ty;
|
|
@ -1,7 +1,7 @@
|
|||
//! This module contains `HashStable` implementations for various data types
|
||||
//! from `rustc_middle::ty` in no particular order.
|
||||
|
||||
use crate::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::middle::region;
|
||||
use crate::mir;
|
||||
use crate::ty;
|
||||
|
@ -163,37 +163,3 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope {
|
|||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::TyVid {
|
||||
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
|
||||
// `TyVid` values are confined to an inference context and hence
|
||||
// should not be hashed.
|
||||
bug!("ty::TyKind::hash_stable() - can't hash a TyVid {:?}.", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::IntVid {
|
||||
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
|
||||
// `IntVid` values are confined to an inference context and hence
|
||||
// should not be hashed.
|
||||
bug!("ty::TyKind::hash_stable() - can't hash an IntVid {:?}.", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::FloatVid {
|
||||
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
|
||||
// `FloatVid` values are confined to an inference context and hence
|
||||
// should not be hashed.
|
||||
bug!("ty::TyKind::hash_stable() - can't hash a FloatVid {:?}.", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for crate::middle::privacy::AccessLevels {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
let crate::middle::privacy::AccessLevels { ref map } = *self;
|
||||
|
||||
map.hash_stable(hcx, hasher);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
//! which are available for use externally when compiled as a library.
|
||||
|
||||
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_span::def_id::LocalDefId;
|
||||
use std::hash::Hash;
|
||||
|
||||
|
@ -53,3 +55,12 @@ impl<Id> Default for AccessLevels<Id> {
|
|||
AccessLevels { map: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,16 @@ doctest = false
|
|||
rustc_arena = { path = "../rustc_arena" }
|
||||
tracing = "0.1"
|
||||
rustc-rayon-core = "0.3.1"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_target = { path = "../rustc_target" }
|
||||
parking_lot = "0.11"
|
||||
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
|
||||
|
|
|
@ -206,4 +206,4 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl rustc_session::HashStableContext for StableHashingContext<'a> {}
|
||||
impl<'a> rustc_session::HashStableContext for StableHashingContext<'a> {}
|
|
@ -4,10 +4,8 @@ pub use self::hcx::{NodeIdHashingMode, StableHashingContext};
|
|||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
||||
mod hcx;
|
||||
|
||||
mod impls_hir;
|
||||
mod impls_syntax;
|
||||
mod impls_ty;
|
||||
|
||||
pub const IGNORED_ATTRIBUTES: &[Symbol] = &[
|
||||
sym::cfg,
|
|
@ -1,3 +1,4 @@
|
|||
#![feature(assert_matches)]
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(hash_raw_entry)]
|
||||
|
@ -14,4 +15,5 @@ extern crate rustc_macros;
|
|||
|
||||
pub mod cache;
|
||||
pub mod dep_graph;
|
||||
pub mod ich;
|
||||
pub mod query;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(once_cell)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue