1
Fork 0

Move some more code from rustc_middle to rustc_query_system

This commit is contained in:
Joshua Nelson 2022-09-11 23:31:50 -05:00
parent f3f91bb514
commit ccc8d000f2
2 changed files with 13 additions and 14 deletions

View file

@ -47,6 +47,7 @@ use crate::ich::StableHashingContext;
use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::definitions::DefPathHash;
use std::fmt;
use std::hash::Hash;
@ -88,6 +89,17 @@ impl<K: DepKind> DepNode<K> {
dep_node
}
/// Construct a DepNode from the given DepKind and DefPathHash. This
/// method will assert that the given DepKind actually requires a
/// single DefId/DefPathHash parameter.
pub fn from_def_path_hash<Ctxt>(tcx: Ctxt, def_path_hash: DefPathHash, kind: K) -> Self
where
Ctxt: super::DepContext<DepKind = K>,
{
debug_assert!(tcx.fingerprint_style(kind) == FingerprintStyle::DefPathHash);
DepNode { kind, hash: def_path_hash.0.into() }
}
}
impl<K: DepKind> fmt::Debug for DepNode<K> {