Skip to content

Commit ee9781c

Browse files
committed
Make QueryContext a subtrait of DepContext.
1 parent c4a451e commit ee9781c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/librustc/ty/query/config.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//! Query configuration and description traits.
22
3+
use crate::dep_graph::DepKind;
34
use crate::dep_graph::SerializedDepNodeIndex;
4-
use crate::dep_graph::{DepKind, DepNode};
55
use crate::ty::query::caches::QueryCache;
66
use crate::ty::query::plumbing::CycleError;
77
use crate::ty::query::QueryState;
88
use rustc_data_structures::profiling::ProfileCategory;
99
use rustc_hir::def_id::DefId;
1010

11-
use crate::ich::StableHashingContext;
1211
use rustc_data_structures::fingerprint::Fingerprint;
12+
use rustc_query_system::dep_graph::{DepContext, DepNode};
1313
use rustc_session::Session;
1414
use std::borrow::Cow;
1515
use std::fmt::Debug;
@@ -23,7 +23,7 @@ pub trait QueryConfig<CTX> {
2323
type Value: Clone;
2424
}
2525

26-
pub trait QueryContext: Copy {
26+
pub trait QueryContext: DepContext<DepKind = DepKind> {
2727
type Query;
2828

2929
/// Access the session.
@@ -36,20 +36,22 @@ pub trait QueryContext: Copy {
3636
pub(crate) trait QueryAccessors<CTX: QueryContext>: QueryConfig<CTX> {
3737
const ANON: bool;
3838
const EVAL_ALWAYS: bool;
39-
const DEP_KIND: DepKind;
39+
const DEP_KIND: CTX::DepKind;
4040

4141
type Cache: QueryCache<CTX, Key = Self::Key, Value = Self::Value>;
4242

4343
// Don't use this method to access query results, instead use the methods on TyCtxt
4444
fn query_state<'a>(tcx: CTX) -> &'a QueryState<CTX, Self::Cache>;
4545

46-
fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode;
46+
fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode<CTX::DepKind>;
4747

4848
// Don't use this method to compute query results, instead use the methods on TyCtxt
4949
fn compute(tcx: CTX, key: Self::Key) -> Self::Value;
5050

51-
fn hash_result(hcx: &mut StableHashingContext<'_>, result: &Self::Value)
52-
-> Option<Fingerprint>;
51+
fn hash_result(
52+
hcx: &mut CTX::StableHashingContext,
53+
result: &Self::Value,
54+
) -> Option<Fingerprint>;
5355

5456
fn handle_cycle_error(tcx: CTX, error: CycleError<CTX>) -> Self::Value;
5557
}

0 commit comments

Comments
 (0)