1
1
//! Query configuration and description traits.
2
2
3
+ use crate :: dep_graph:: DepKind ;
3
4
use crate :: dep_graph:: SerializedDepNodeIndex ;
4
- use crate :: dep_graph:: { DepKind , DepNode } ;
5
5
use crate :: ty:: query:: caches:: QueryCache ;
6
6
use crate :: ty:: query:: plumbing:: CycleError ;
7
7
use crate :: ty:: query:: QueryState ;
8
8
use rustc_data_structures:: profiling:: ProfileCategory ;
9
9
use rustc_hir:: def_id:: DefId ;
10
10
11
- use crate :: ich:: StableHashingContext ;
12
11
use rustc_data_structures:: fingerprint:: Fingerprint ;
12
+ use rustc_query_system:: dep_graph:: { DepContext , DepNode } ;
13
13
use rustc_session:: Session ;
14
14
use std:: borrow:: Cow ;
15
15
use std:: fmt:: Debug ;
@@ -23,7 +23,7 @@ pub trait QueryConfig<CTX> {
23
23
type Value : Clone ;
24
24
}
25
25
26
- pub trait QueryContext : Copy {
26
+ pub trait QueryContext : DepContext < DepKind = DepKind > {
27
27
type Query ;
28
28
29
29
/// Access the session.
@@ -36,20 +36,22 @@ pub trait QueryContext: Copy {
36
36
pub ( crate ) trait QueryAccessors < CTX : QueryContext > : QueryConfig < CTX > {
37
37
const ANON : bool ;
38
38
const EVAL_ALWAYS : bool ;
39
- const DEP_KIND : DepKind ;
39
+ const DEP_KIND : CTX :: DepKind ;
40
40
41
41
type Cache : QueryCache < CTX , Key = Self :: Key , Value = Self :: Value > ;
42
42
43
43
// Don't use this method to access query results, instead use the methods on TyCtxt
44
44
fn query_state < ' a > ( tcx : CTX ) -> & ' a QueryState < CTX , Self :: Cache > ;
45
45
46
- fn to_dep_node ( tcx : CTX , key : & Self :: Key ) -> DepNode ;
46
+ fn to_dep_node ( tcx : CTX , key : & Self :: Key ) -> DepNode < CTX :: DepKind > ;
47
47
48
48
// Don't use this method to compute query results, instead use the methods on TyCtxt
49
49
fn compute ( tcx : CTX , key : Self :: Key ) -> Self :: Value ;
50
50
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 > ;
53
55
54
56
fn handle_cycle_error ( tcx : CTX , error : CycleError < CTX > ) -> Self :: Value ;
55
57
}
0 commit comments