Remove unused category from macros.

This commit is contained in:
Camille GILLOT 2020-10-11 20:44:24 +02:00
parent 0a4d948b4a
commit de763701e1
3 changed files with 11 additions and 22 deletions

View File

@ -190,7 +190,11 @@ impl<T: Parse> Parse for List<T> {
}
/// A named group containing queries.
///
/// For now, the name is not used any more, but the capability remains interesting for future
/// developments of the query system.
struct Group {
#[allow(unused)]
name: Ident,
queries: List<Query>,
}
@ -422,7 +426,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
let mut cached_queries = quote! {};
for group in groups.0 {
let mut group_stream = quote! {};
for mut query in group.queries.0 {
let modifiers = process_modifiers(&mut query);
let name = &query.name;
@ -485,7 +488,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
let attribute_stream = quote! {#(#attributes),*};
let doc_comments = query.doc_comments.iter();
// Add the query to the group
group_stream.extend(quote! {
query_stream.extend(quote! {
#(#doc_comments)*
[#attribute_stream] fn #name: #name(#arg) #result,
});
@ -514,10 +517,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
add_query_description_impl(&query, modifiers, &mut query_description_stream);
}
let name = &group.name;
query_stream.extend(quote! {
#name { #group_stream },
});
}
dep_node_force_stream.extend(quote! {

View File

@ -242,24 +242,14 @@ macro_rules! hash_result {
};
}
macro_rules! define_queries {
(<$tcx:tt> $($category:tt {
$($(#[$attr:meta])* [$($modifiers:tt)*] fn $name:ident: $node:ident($($K:tt)*) -> $V:ty,)*
},)*) => {
define_queries_inner! { <$tcx>
$($( $(#[$attr])* category<$category> [$($modifiers)*] fn $name: $node($($K)*) -> $V,)*)*
}
}
}
macro_rules! query_helper_param_ty {
(DefId) => { impl IntoQueryParam<DefId> };
($K:ty) => { $K };
}
macro_rules! define_queries_inner {
macro_rules! define_queries {
(<$tcx:tt>
$($(#[$attr:meta])* category<$category:tt>
$($(#[$attr:meta])*
[$($modifiers:tt)*] fn $name:ident: $node:ident($($K:tt)*) -> $V:ty,)*) => {
use std::mem;

View File

@ -120,13 +120,13 @@ pub fn print_stats(tcx: TyCtxt<'_>) {
}
macro_rules! print_stats {
(<$tcx:tt> $($category:tt {
(<$tcx:tt>
$($(#[$attr:meta])* [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*
},)*) => {
) => {
fn query_stats(tcx: TyCtxt<'_>) -> Vec<QueryStats> {
let mut queries = Vec::new();
$($(
$(
queries.push(stats::<
crate::dep_graph::DepKind,
<TyCtxt<'_> as QueryContext>::Query,
@ -135,7 +135,7 @@ macro_rules! print_stats {
stringify!($name),
&tcx.queries.$name,
));
)*)*
)*
queries
}