diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-03-18 20:19:44 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-03-26 09:22:45 +0100 |
| commit | ee9781cea03142b23ee609096b18d03aeaf1648b (patch) | |
| tree | 16ef68f87ed2e4a14221d55541d81da28a99822f /src/librustc | |
| parent | c4a451e5af8ed1153a5a7a127c594265bd44e624 (diff) | |
| download | rust-ee9781cea03142b23ee609096b18d03aeaf1648b.tar.gz rust-ee9781cea03142b23ee609096b18d03aeaf1648b.zip | |
Make QueryContext a subtrait of DepContext.
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/ty/query/config.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index fd2f855d5b1..77feb7f4df3 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -1,15 +1,15 @@ //! Query configuration and description traits. +use crate::dep_graph::DepKind; use crate::dep_graph::SerializedDepNodeIndex; -use crate::dep_graph::{DepKind, DepNode}; use crate::ty::query::caches::QueryCache; use crate::ty::query::plumbing::CycleError; use crate::ty::query::QueryState; use rustc_data_structures::profiling::ProfileCategory; use rustc_hir::def_id::DefId; -use crate::ich::StableHashingContext; use rustc_data_structures::fingerprint::Fingerprint; +use rustc_query_system::dep_graph::{DepContext, DepNode}; use rustc_session::Session; use std::borrow::Cow; use std::fmt::Debug; @@ -23,7 +23,7 @@ pub trait QueryConfig<CTX> { type Value: Clone; } -pub trait QueryContext: Copy { +pub trait QueryContext: DepContext<DepKind = DepKind> { type Query; /// Access the session. @@ -36,20 +36,22 @@ pub trait QueryContext: Copy { pub(crate) trait QueryAccessors<CTX: QueryContext>: QueryConfig<CTX> { const ANON: bool; const EVAL_ALWAYS: bool; - const DEP_KIND: DepKind; + const DEP_KIND: CTX::DepKind; type Cache: QueryCache<CTX, Key = Self::Key, Value = Self::Value>; // Don't use this method to access query results, instead use the methods on TyCtxt fn query_state<'a>(tcx: CTX) -> &'a QueryState<CTX, Self::Cache>; - fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode; + fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode<CTX::DepKind>; // Don't use this method to compute query results, instead use the methods on TyCtxt fn compute(tcx: CTX, key: Self::Key) -> Self::Value; - fn hash_result(hcx: &mut StableHashingContext<'_>, result: &Self::Value) - -> Option<Fingerprint>; + fn hash_result( + hcx: &mut CTX::StableHashingContext, + result: &Self::Value, + ) -> Option<Fingerprint>; fn handle_cycle_error(tcx: CTX, error: CycleError<CTX>) -> Self::Value; } |
