about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-08-29 18:46:56 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-09-06 21:43:15 -0500
commitc630c87ceb0c49c5dc2b1a6119c67e9033dce828 (patch)
tree36bd534906df11e7d7dbebbcc3423f5d3f2dc753
parent05886e28a4c3fbb7bc22d56bf5a52ba7cfa491d9 (diff)
downloadrust-c630c87ceb0c49c5dc2b1a6119c67e9033dce828.tar.gz
rust-c630c87ceb0c49c5dc2b1a6119c67e9033dce828.zip
Support doc-comments in `define_dep_nodes`
-rw-r--r--compiler/rustc_macros/src/query.rs8
-rw-r--r--compiler/rustc_middle/src/dep_graph/dep_node.rs8
-rw-r--r--compiler/rustc_query_impl/src/profiling_support.rs4
3 files changed, 12 insertions, 8 deletions
diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs
index 2a1bb10fdfc..046a144913e 100644
--- a/compiler/rustc_macros/src/query.rs
+++ b/compiler/rustc_macros/src/query.rs
@@ -344,7 +344,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
                 #name,
             });
         }
-        all_names.extend(quote! { #name, });
 
         let mut attributes = Vec::new();
 
@@ -394,13 +393,18 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
         // be very useful.
         let span = name.span();
         let attribute_stream = quote_spanned! {span=> #(#attributes),*};
-        let doc_comments = query.doc_comments.iter();
+        let doc_comments = &query.doc_comments;
         // Add the query to the group
         query_stream.extend(quote! {
             #(#doc_comments)*
             [#attribute_stream] fn #name(#arg) #result,
         });
 
+        all_names.extend(quote! {
+            #(#doc_comments)*
+            #name,
+        });
+
         add_query_description_impl(&query, &mut query_description_stream);
     }
 
diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs
index f54d75c24e2..21d174af444 100644
--- a/compiler/rustc_middle/src/dep_graph/dep_node.rs
+++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs
@@ -144,7 +144,7 @@ impl DepKind {
 
 macro_rules! define_dep_nodes {
     (
-        $( $variant:ident, )*
+        $( $( #[$attr:meta] )* $variant:ident, )+
     ) => (
         #[macro_export]
         macro_rules! make_dep_kind_array {
@@ -155,7 +155,7 @@ macro_rules! define_dep_nodes {
         #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
         #[allow(non_camel_case_types)]
         pub enum DepKind {
-            $($variant),*
+            $( $( #[$attr] )* $variant),*
         }
 
         fn dep_kind_from_label_string(label: &str) -> Result<DepKind, ()> {
@@ -177,9 +177,9 @@ macro_rules! define_dep_nodes {
 }
 
 rustc_query_names!(define_dep_nodes![
-    // We use this for most things when incr. comp. is turned off.
+    /// We use this for most things when incr. comp. is turned off.
     Null,
-    // We use this to create a forever-red node.
+    /// We use this to create a forever-red node.
     Red,
     TraitSelect,
     CompileCodegenUnit,
diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs
index a8e0210e8d6..a9bb4756dbc 100644
--- a/compiler/rustc_query_impl/src/profiling_support.rs
+++ b/compiler/rustc_query_impl/src/profiling_support.rs
@@ -307,7 +307,7 @@ pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) {
 
     macro_rules! alloc_once {
         (
-            $($name:ident,)*
+            $( $( #[$attr:meta] )* $name:ident, )+
         ) => {
             $({
                 alloc_self_profile_query_strings_for_query_cache(
@@ -316,7 +316,7 @@ pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) {
                     &tcx.query_caches.$name,
                     &mut string_cache,
                 );
-            })*
+            })+
         }
     }