Move ICH to rustc_query_system.

This commit is contained in:
Camille GILLOT
2020-11-14 16:35:31 +01:00
parent 2d38c53767
commit c355b2e5cd
11 changed files with 30 additions and 39 deletions

View File

@@ -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);
});
}
}