Skip to content

Commit c355b2e

Browse files
committed
Move ICH to rustc_query_system.
1 parent 2d38c53 commit c355b2e

File tree

11 files changed

+30
-39
lines changed

11 files changed

+30
-39
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,13 +4308,17 @@ dependencies = [
43084308
"parking_lot",
43094309
"rustc-rayon-core",
43104310
"rustc_arena",
4311+
"rustc_ast",
43114312
"rustc_data_structures",
43124313
"rustc_errors",
4314+
"rustc_feature",
4315+
"rustc_hir",
43134316
"rustc_index",
43144317
"rustc_macros",
43154318
"rustc_serialize",
43164319
"rustc_session",
43174320
"rustc_span",
4321+
"rustc_target",
43184322
"smallvec",
43194323
"tracing",
43204324
]

compiler/rustc_middle/src/ich.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! ICH - Incremental Compilation Hash
2+
3+
pub use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
4+
5+
mod impls_ty;

compiler/rustc_middle/src/ich/impls_ty.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This module contains `HashStable` implementations for various data types
22
//! from `rustc_middle::ty` in no particular order.
33
4-
use crate::ich::{NodeIdHashingMode, StableHashingContext};
4+
use crate::ich::StableHashingContext;
55
use crate::middle::region;
66
use crate::mir;
77
use crate::ty;
@@ -163,37 +163,3 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope {
163163
*self
164164
}
165165
}
166-
167-
impl<'a> HashStable<StableHashingContext<'a>> for ty::TyVid {
168-
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
169-
// `TyVid` values are confined to an inference context and hence
170-
// should not be hashed.
171-
bug!("ty::TyKind::hash_stable() - can't hash a TyVid {:?}.", *self)
172-
}
173-
}
174-
175-
impl<'a> HashStable<StableHashingContext<'a>> for ty::IntVid {
176-
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
177-
// `IntVid` values are confined to an inference context and hence
178-
// should not be hashed.
179-
bug!("ty::TyKind::hash_stable() - can't hash an IntVid {:?}.", *self)
180-
}
181-
}
182-
183-
impl<'a> HashStable<StableHashingContext<'a>> for ty::FloatVid {
184-
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
185-
// `FloatVid` values are confined to an inference context and hence
186-
// should not be hashed.
187-
bug!("ty::TyKind::hash_stable() - can't hash a FloatVid {:?}.", *self)
188-
}
189-
}
190-
191-
impl<'a> HashStable<StableHashingContext<'a>> for crate::middle::privacy::AccessLevels {
192-
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
193-
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
194-
let crate::middle::privacy::AccessLevels { ref map } = *self;
195-
196-
map.hash_stable(hcx, hasher);
197-
});
198-
}
199-
}

compiler/rustc_middle/src/middle/privacy.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
//! which are available for use externally when compiled as a library.
44
55
use rustc_data_structures::fx::FxHashMap;
6+
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
67
use rustc_macros::HashStable;
8+
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
79
use rustc_span::def_id::LocalDefId;
810
use std::hash::Hash;
911

@@ -53,3 +55,12 @@ impl<Id> Default for AccessLevels<Id> {
5355
AccessLevels { map: Default::default() }
5456
}
5557
}
58+
59+
impl<'a> HashStable<StableHashingContext<'a>> for AccessLevels {
60+
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
61+
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
62+
let AccessLevels { ref map } = *self;
63+
map.hash_stable(hcx, hasher);
64+
});
65+
}
66+
}

compiler/rustc_query_system/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ doctest = false
1010
rustc_arena = { path = "../rustc_arena" }
1111
tracing = "0.1"
1212
rustc-rayon-core = "0.3.1"
13+
rustc_ast = { path = "../rustc_ast" }
1314
rustc_data_structures = { path = "../rustc_data_structures" }
1415
rustc_errors = { path = "../rustc_errors" }
15-
rustc_macros = { path = "../rustc_macros" }
16+
rustc_feature = { path = "../rustc_feature" }
17+
rustc_hir = { path = "../rustc_hir" }
1618
rustc_index = { path = "../rustc_index" }
19+
rustc_macros = { path = "../rustc_macros" }
1720
rustc_serialize = { path = "../rustc_serialize" }
1821
rustc_session = { path = "../rustc_session" }
1922
rustc_span = { path = "../rustc_span" }
23+
rustc_target = { path = "../rustc_target" }
2024
parking_lot = "0.11"
2125
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }

compiler/rustc_middle/src/ich/hcx.rs renamed to compiler/rustc_query_system/src/ich/hcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,4 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
206206
}
207207
}
208208

209-
impl rustc_session::HashStableContext for StableHashingContext<'a> {}
209+
impl<'a> rustc_session::HashStableContext for StableHashingContext<'a> {}

compiler/rustc_middle/src/ich/mod.rs renamed to compiler/rustc_query_system/src/ich/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ pub use self::hcx::{NodeIdHashingMode, StableHashingContext};
44
use rustc_span::symbol::{sym, Symbol};
55

66
mod hcx;
7-
87
mod impls_hir;
98
mod impls_syntax;
10-
mod impls_ty;
119

1210
pub const IGNORED_ATTRIBUTES: &[Symbol] = &[
1311
sym::cfg,

compiler/rustc_query_system/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(assert_matches)]
12
#![feature(bool_to_option)]
23
#![feature(core_intrinsics)]
34
#![feature(hash_raw_entry)]
@@ -14,4 +15,5 @@ extern crate rustc_macros;
1415

1516
pub mod cache;
1617
pub mod dep_graph;
18+
pub mod ich;
1719
pub mod query;

compiler/rustc_session/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(crate_visibility_modifier)]
2+
#![feature(min_specialization)]
23
#![feature(once_cell)]
34
#![recursion_limit = "256"]
45

0 commit comments

Comments
 (0)