about summary refs log tree commit diff
path: root/compiler/rustc_query_impl/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-10-16 22:31:48 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-10-20 18:29:18 +0200
commitaa404c24ddafea428cb86de8f914b129be4a726b (patch)
tree0e3dda9def1c7c8ec7655dce81201f51f0a6e818 /compiler/rustc_query_impl/src
parente53404cca68e8220a57339cb3e213fd0d8e99a5f (diff)
downloadrust-aa404c24ddafea428cb86de8f914b129be4a726b.tar.gz
rust-aa404c24ddafea428cb86de8f914b129be4a726b.zip
Make hash_result an Option.
Diffstat (limited to 'compiler/rustc_query_impl/src')
-rw-r--r--compiler/rustc_query_impl/src/plumbing.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs
index 4d1e39db0ed..10dac9953aa 100644
--- a/compiler/rustc_query_impl/src/plumbing.rs
+++ b/compiler/rustc_query_impl/src/plumbing.rs
@@ -291,14 +291,14 @@ macro_rules! is_eval_always {
 }
 
 macro_rules! hash_result {
-    ([][$hcx:expr, $result:expr]) => {{
-        dep_graph::hash_result($hcx, &$result)
+    ([]) => {{
+        Some(dep_graph::hash_result)
     }};
-    ([(no_hash) $($rest:tt)*][$hcx:expr, $result:expr]) => {{
+    ([(no_hash) $($rest:tt)*]) => {{
         None
     }};
-    ([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
-        hash_result!([$($modifiers)*][$($args)*])
+    ([$other:tt $($modifiers:tt)*]) => {
+        hash_result!([$($modifiers)*])
     };
 }
 
@@ -378,6 +378,7 @@ macro_rules! define_queries {
             const ANON: bool = is_anon!([$($modifiers)*]);
             const EVAL_ALWAYS: bool = is_eval_always!([$($modifiers)*]);
             const DEP_KIND: dep_graph::DepKind = dep_graph::DepKind::$name;
+            const HASH_RESULT: Option<fn(&mut StableHashingContext<'_>, &Self::Value) -> Fingerprint> = hash_result!([$($modifiers)*]);
 
             type Cache = query_storage::$name<$tcx>;
 
@@ -406,13 +407,6 @@ macro_rules! define_queries {
                 }
             }
 
-            fn hash_result(
-                _hcx: &mut StableHashingContext<'_>,
-                _result: &Self::Value
-            ) -> Option<Fingerprint> {
-                hash_result!([$($modifiers)*][_hcx, _result])
-            }
-
             fn handle_cycle_error(
                 tcx: QueryCtxt<'tcx>,
                 mut error: DiagnosticBuilder<'_>,