Do not store stable crate id in on-disk hash map.
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_span::def_id::{DefIndex, DefPathHash};
|
||||
use rustc_data_structures::stable_hasher::Hash64;
|
||||
use rustc_span::def_id::DefIndex;
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct Config;
|
||||
|
||||
impl odht::Config for Config {
|
||||
type Key = DefPathHash;
|
||||
// This hash-map is single-crate, so we only need to key by the local hash.
|
||||
type Key = Hash64;
|
||||
type Value = DefIndex;
|
||||
|
||||
type EncodedKey = [u8; 16];
|
||||
type EncodedKey = [u8; 8];
|
||||
type EncodedValue = [u8; 4];
|
||||
|
||||
type H = odht::UnHashFn;
|
||||
|
||||
#[inline]
|
||||
fn encode_key(k: &DefPathHash) -> [u8; 16] {
|
||||
k.0.to_le_bytes()
|
||||
fn encode_key(k: &Hash64) -> [u8; 8] {
|
||||
k.as_u64().to_le_bytes()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -24,8 +25,8 @@ impl odht::Config for Config {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn decode_key(k: &[u8; 16]) -> DefPathHash {
|
||||
DefPathHash(Fingerprint::from_le_bytes(*k))
|
||||
fn decode_key(k: &[u8; 8]) -> Hash64 {
|
||||
Hash64::new(u64::from_le_bytes(*k))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user