From ee9781cea03142b23ee609096b18d03aeaf1648b Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 18 Mar 2020 20:19:44 +0100 Subject: [PATCH] Make QueryContext a subtrait of DepContext. --- src/librustc/ty/query/config.rs | 16 +++++++++------- 1 file 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 { type Value: Clone; } -pub trait QueryContext: Copy { +pub trait QueryContext: DepContext { type Query; /// Access the session. @@ -36,20 +36,22 @@ pub trait QueryContext: Copy { pub(crate) trait QueryAccessors: QueryConfig { const ANON: bool; const EVAL_ALWAYS: bool; - const DEP_KIND: DepKind; + const DEP_KIND: CTX::DepKind; type Cache: QueryCache; // Don't use this method to access query results, instead use the methods on TyCtxt fn query_state<'a>(tcx: CTX) -> &'a QueryState; - fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode; + fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode; // 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; + fn hash_result( + hcx: &mut CTX::StableHashingContext, + result: &Self::Value, + ) -> Option; fn handle_cycle_error(tcx: CTX, error: CycleError) -> Self::Value; } -- 2.44.0