about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/query.rs
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-09-06 21:26:02 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-09-06 21:46:31 -0500
commit3a4e3c778889fdf2c4ccb7af26f1e81fc324e98b (patch)
tree0ceeb33352bfdf89517471c018a8ffff0c9831df /compiler/rustc_macros/src/query.rs
parentc630c87ceb0c49c5dc2b1a6119c67e9033dce828 (diff)
downloadrust-3a4e3c778889fdf2c4ccb7af26f1e81fc324e98b.tar.gz
rust-3a4e3c778889fdf2c4ccb7af26f1e81fc324e98b.zip
Get rid of the emitted `rustc_query_names` and `rustc_cached_queries` macro
We can avoid these by adding slightly more information to `rustc_query_append` instead.
Diffstat (limited to 'compiler/rustc_macros/src/query.rs')
-rw-r--r--compiler/rustc_macros/src/query.rs29
1 files changed, 7 insertions, 22 deletions
diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs
index 046a144913e..505b2d62a79 100644
--- a/compiler/rustc_macros/src/query.rs
+++ b/compiler/rustc_macros/src/query.rs
@@ -328,7 +328,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
 
     let mut query_stream = quote! {};
     let mut query_description_stream = quote! {};
-    let mut all_names = quote! {};
     let mut cached_queries = quote! {};
 
     for query in queries.0 {
@@ -384,6 +383,10 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
         if let Some(remap_env_constness) = &modifiers.remap_env_constness {
             attributes.push(quote! { (#remap_env_constness) });
         }
+        // Pass on the const modifier
+        if modifiers.cache.is_some() {
+            attributes.push(quote! { (cache) });
+        }
 
         // This uses the span of the query definition for the commas,
         // which can be important if we later encounter any ambiguity
@@ -400,38 +403,20 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
             [#attribute_stream] fn #name(#arg) #result,
         });
 
-        all_names.extend(quote! {
-            #(#doc_comments)*
-            #name,
-        });
-
         add_query_description_impl(&query, &mut query_description_stream);
     }
 
     TokenStream::from(quote! {
         #[macro_export]
         macro_rules! rustc_query_append {
-            ($macro:ident!) => {
+            ($macro:ident! $( [$($other:tt)*] )?) => {
                 $macro! {
+                    $( $($other)* )?
                     #query_stream
                 }
             }
         }
-        #[macro_export]
-        macro_rules! rustc_query_names {
-            ($macro:ident! $( [$($other:tt)*] )?) => {
-                $macro!(
-                    $( $($other)* )?
-                    #all_names
-                );
-            }
-        }
-        #[macro_export]
-        macro_rules! rustc_cached_queries {
-            ($macro:ident!) => {
-                $macro!(#cached_queries);
-            }
-        }
+
         #[macro_export]
         macro_rules! rustc_query_description {
             #query_description_stream