9
9
// except according to those terms.
10
10
11
11
use dep_graph:: SerializedDepNodeIndex ;
12
+ use dep_graph:: DepNode ;
12
13
use hir:: def_id:: { CrateNum , DefId , DefIndex } ;
13
14
use mir:: interpret:: { GlobalId } ;
14
15
use traits:: query:: { CanonicalPredicateGoal , CanonicalProjectionGoal , CanonicalTyGoal } ;
@@ -19,20 +20,31 @@ use ty::maps::Query;
19
20
use ty:: maps:: QueryMap ;
20
21
21
22
use std:: hash:: Hash ;
23
+ use std:: fmt:: Debug ;
22
24
use syntax_pos:: symbol:: InternedString ;
23
25
use rustc_data_structures:: sync:: Lock ;
26
+ use rustc_data_structures:: stable_hasher:: HashStable ;
27
+ use ich:: StableHashingContext ;
24
28
25
29
/// Query configuration and description traits.
26
30
27
31
pub trait QueryConfig < ' tcx > {
28
- type Key : Eq + Hash + Clone ;
29
- type Value : Clone ;
32
+ const NAME : & ' static str ;
33
+
34
+ type Key : Eq + Hash + Clone + Debug ;
35
+ type Value : Clone + for < ' a > HashStable < StableHashingContext < ' a > > ;
30
36
31
37
fn query ( key : Self :: Key ) -> Query < ' tcx > ;
32
38
fn query_map < ' a > ( tcx : TyCtxt < ' a , ' tcx , ' _ > ) -> & ' a Lock < QueryMap < ' tcx , Self > > ;
39
+
40
+ fn to_dep_node ( tcx : TyCtxt < ' _ , ' tcx , ' _ > , key : & Self :: Key ) -> DepNode ;
41
+
42
+ fn compute ( tcx : TyCtxt < ' _ , ' tcx , ' _ > , key : Self :: Key ) -> Self :: Value ;
43
+
44
+ fn handle_cycle_error ( tcx : TyCtxt < ' _ , ' tcx , ' _ > ) -> Self :: Value ;
33
45
}
34
46
35
- pub ( super ) trait QueryDescription < ' tcx > : QueryConfig < ' tcx > {
47
+ pub trait QueryDescription < ' tcx > : QueryConfig < ' tcx > {
36
48
fn describe ( tcx : TyCtxt , key : Self :: Key ) -> String ;
37
49
38
50
#[ inline]
0 commit comments