about summary refs log tree commit diff
path: root/compiler/rustc_macros
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-08-24 00:02:37 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-08-24 00:37:49 -0500
commit7b8e2a52ff29d400b4d869fad1d917ffa9bdce59 (patch)
tree636f16eae4d3f7948678fcf7449770f8e23e6588 /compiler/rustc_macros
parente188868014da60bc266024e60c914b532445c743 (diff)
downloadrust-7b8e2a52ff29d400b4d869fad1d917ffa9bdce59.tar.gz
rust-7b8e2a52ff29d400b4d869fad1d917ffa9bdce59.zip
Simplify the syntax for macros generated by `rustc_queries`
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used.
- Remove the `[]` brackets around the macro name
- Require an `ident`, not an arbitrary `tt`
Diffstat (limited to 'compiler/rustc_macros')
-rw-r--r--compiler/rustc_macros/src/query.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs
index 32a15413c6f..d80d35cb1fa 100644
--- a/compiler/rustc_macros/src/query.rs
+++ b/compiler/rustc_macros/src/query.rs
@@ -400,15 +400,15 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
     TokenStream::from(quote! {
         #[macro_export]
         macro_rules! rustc_query_append {
-            ([$($macro:tt)*]) => {
-                $($macro)* {
+            ($macro:ident !) => {
+                $macro! {
                     #query_stream
                 }
             }
         }
         macro_rules! rustc_dep_node_append {
-            ([$($macro:tt)*][$($other:tt)*]) => {
-                $($macro)*(
+            ($macro:ident! [$($other:tt)*]) => {
+                $macro!(
                     $($other)*
 
                     #dep_node_def_stream
@@ -417,8 +417,8 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
         }
         #[macro_export]
         macro_rules! rustc_cached_queries {
-            ($($macro:tt)*) => {
-                $($macro)*(#cached_queries);
+            ( $macro:ident! ) => {
+                $macro!(#cached_queries);
             }
         }
         #[macro_export]