@@ -24,7 +24,7 @@ pub(crate) struct QueryVtable<CTX: QueryContext, K, V> {
2424 pub dep_kind : CTX :: DepKind ,
2525 pub eval_always : bool ,
2626
27- pub hash_result : fn ( & mut StableHashingContext < ' _ > , & V ) -> Option < Fingerprint > ,
27+ pub hash_result : Option < fn ( & mut StableHashingContext < ' _ > , & V ) -> Fingerprint > ,
2828 pub handle_cycle_error : fn ( CTX , DiagnosticBuilder < ' _ > ) -> V ,
2929 pub cache_on_disk : fn ( CTX , & K , Option < & V > ) -> bool ,
3030 pub try_load_from_disk : fn ( CTX , SerializedDepNodeIndex ) -> Option < V > ,
@@ -38,14 +38,6 @@ impl<CTX: QueryContext, K, V> QueryVtable<CTX, K, V> {
3838 DepNode :: construct ( tcx, self . dep_kind , key)
3939 }
4040
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-
4941 pub ( crate ) fn cache_on_disk ( & self , tcx : CTX , key : & K , value : Option < & V > ) -> bool {
5042 ( self . cache_on_disk ) ( tcx, key, value)
5143 }
@@ -59,6 +51,9 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
5951 const ANON : bool ;
6052 const EVAL_ALWAYS : bool ;
6153 const DEP_KIND : CTX :: DepKind ;
54+ const HASH_RESULT : Option <
55+ fn ( hcx : & mut StableHashingContext < ' _ > , result : & Self :: Value ) -> Fingerprint ,
56+ > ;
6257
6358 type Cache : QueryCache < Key = Self :: Key , Stored = Self :: Stored , Value = Self :: Value > ;
6459
@@ -75,9 +70,6 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
7570 // Don't use this method to compute query results, instead use the methods on TyCtxt
7671 fn compute_fn ( tcx : CTX , key : & Self :: Key ) -> fn ( CTX :: DepContext , Self :: Key ) -> Self :: Value ;
7772
78- fn hash_result ( hcx : & mut StableHashingContext < ' _ > , result : & Self :: Value )
79- -> Option < Fingerprint > ;
80-
8173 fn handle_cycle_error ( tcx : CTX , diag : DiagnosticBuilder < ' _ > ) -> Self :: Value ;
8274}
8375
10799 anon : Q :: ANON ,
108100 dep_kind : Q :: DEP_KIND ,
109101 eval_always : Q :: EVAL_ALWAYS ,
110- hash_result : Q :: hash_result ,
102+ hash_result : Q :: HASH_RESULT ,
111103 handle_cycle_error : Q :: handle_cycle_error,
112104 cache_on_disk : Q :: cache_on_disk,
113105 try_load_from_disk : Q :: try_load_from_disk,
0 commit comments