1
Fork 0

Decouple QueryContext from DepContext.

This commit is contained in:
Camille GILLOT 2020-10-18 21:01:36 +02:00
parent 6f04883023
commit 49c1b07a9e
7 changed files with 87 additions and 53 deletions

View file

@ -63,6 +63,27 @@ pub trait DepContext: Copy {
fn profiler(&self) -> &SelfProfilerRef;
}
pub trait HasDepContext: Copy {
type DepKind: self::DepKind;
type StableHashingContext;
type DepContext: self::DepContext<
DepKind = Self::DepKind,
StableHashingContext = Self::StableHashingContext,
>;
fn dep_context(&self) -> &Self::DepContext;
}
impl<T: DepContext> HasDepContext for T {
type DepKind = T::DepKind;
type StableHashingContext = T::StableHashingContext;
type DepContext = Self;
fn dep_context(&self) -> &Self::DepContext {
self
}
}
/// Describe the different families of dependency nodes.
pub trait DepKind: Copy + fmt::Debug + Eq + Hash {
const NULL: Self;