Support doc-comments in define_dep_nodes

This commit is contained in:
Joshua Nelson 2022-08-29 18:46:56 -05:00
parent 05886e28a4
commit c630c87ceb
3 changed files with 12 additions and 8 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -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,
);
})*
})+
}
}