@@ -24,7 +24,7 @@ pub(crate) struct QueryVtable<CTX: QueryContext, K, V> {
24
24
pub dep_kind : CTX :: DepKind ,
25
25
pub eval_always : bool ,
26
26
27
- pub hash_result : fn ( & mut StableHashingContext < ' _ > , & V ) -> Option < Fingerprint > ,
27
+ pub hash_result : Option < fn ( & mut StableHashingContext < ' _ > , & V ) -> Fingerprint > ,
28
28
pub handle_cycle_error : fn ( CTX , DiagnosticBuilder < ' _ > ) -> V ,
29
29
pub cache_on_disk : fn ( CTX , & K , Option < & V > ) -> bool ,
30
30
pub try_load_from_disk : fn ( CTX , SerializedDepNodeIndex ) -> Option < V > ,
@@ -38,14 +38,6 @@ impl<CTX: QueryContext, K, V> QueryVtable<CTX, K, V> {
38
38
DepNode :: construct ( tcx, self . dep_kind , key)
39
39
}
40
40
41
- pub ( crate ) fn hash_result (
42
- & self ,
43
- hcx : & mut StableHashingContext < ' _ > ,
44
- value : & V ,
45
- ) -> Option < Fingerprint > {
46
- ( self . hash_result ) ( hcx, value)
47
- }
48
-
49
41
pub ( crate ) fn cache_on_disk ( & self , tcx : CTX , key : & K , value : Option < & V > ) -> bool {
50
42
( self . cache_on_disk ) ( tcx, key, value)
51
43
}
@@ -59,6 +51,9 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
59
51
const ANON : bool ;
60
52
const EVAL_ALWAYS : bool ;
61
53
const DEP_KIND : CTX :: DepKind ;
54
+ const HASH_RESULT : Option <
55
+ fn ( hcx : & mut StableHashingContext < ' _ > , result : & Self :: Value ) -> Fingerprint ,
56
+ > ;
62
57
63
58
type Cache : QueryCache < Key = Self :: Key , Stored = Self :: Stored , Value = Self :: Value > ;
64
59
@@ -75,9 +70,6 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
75
70
// Don't use this method to compute query results, instead use the methods on TyCtxt
76
71
fn compute_fn ( tcx : CTX , key : & Self :: Key ) -> fn ( CTX :: DepContext , Self :: Key ) -> Self :: Value ;
77
72
78
- fn hash_result ( hcx : & mut StableHashingContext < ' _ > , result : & Self :: Value )
79
- -> Option < Fingerprint > ;
80
-
81
73
fn handle_cycle_error ( tcx : CTX , diag : DiagnosticBuilder < ' _ > ) -> Self :: Value ;
82
74
}
83
75
107
99
anon : Q :: ANON ,
108
100
dep_kind : Q :: DEP_KIND ,
109
101
eval_always : Q :: EVAL_ALWAYS ,
110
- hash_result : Q :: hash_result ,
102
+ hash_result : Q :: HASH_RESULT ,
111
103
handle_cycle_error : Q :: handle_cycle_error,
112
104
cache_on_disk : Q :: cache_on_disk,
113
105
try_load_from_disk : Q :: try_load_from_disk,
0 commit comments