Rename rustc_query_append! to rustc_with_all_queries!

This commit is contained in:
Zalathar 2025-04-29 17:55:17 +10:00
parent 4c83e55e2d
commit 64bcf3b9f6
5 changed files with 21 additions and 7 deletions

View file

@ -407,11 +407,23 @@ pub(super) fn rustc_queries(input: TokenStream) -> TokenStream {
}
TokenStream::from(quote! {
/// Higher-order macro that invokes the specified macro with a prepared
/// list of all query signatures (including modifiers).
///
/// This allows multiple simpler macros to each have access to the list
/// of queries.
#[macro_export]
macro_rules! rustc_query_append {
($macro:ident! $( [$($other:tt)*] )?) => {
macro_rules! rustc_with_all_queries {
(
// The macro to invoke once, on all queries (plus extras).
$macro:ident!
// Within [], an optional list of extra "query" signatures to
// pass to the given macro, in addition to the actual queries.
$( [$($extra_fake_queries:tt)*] )?
) => {
$macro! {
$( $($other)* )?
$( $($extra_fake_queries)* )?
#query_stream
}
}

View file

@ -83,7 +83,9 @@ macro_rules! define_dep_nodes {
};
}
rustc_query_append!(define_dep_nodes![
// Create various data structures for each query, and also for a few things
// that aren't queries.
rustc_with_all_queries!(define_dep_nodes![
/// We use this for most things when incr. comp. is turned off.
[] fn Null() -> (),
/// We use this to create a forever-red node.

View file

@ -2578,5 +2578,5 @@ rustc_queries! {
}
}
rustc_query_append! { define_callbacks! }
rustc_with_all_queries! { define_callbacks! }
rustc_feedable_queries! { define_feedable! }

View file

@ -234,7 +234,7 @@ pub fn query_system<'a>(
}
}
rustc_middle::rustc_query_append! { define_queries! }
rustc_middle::rustc_with_all_queries! { define_queries! }
pub fn provide(providers: &mut rustc_middle::util::Providers) {
providers.hooks.alloc_self_profile_query_strings = alloc_self_profile_query_strings;

View file

@ -575,7 +575,7 @@ where
}
// NOTE: `$V` isn't used here, but we still need to match on it so it can be passed to other macros
// invoked by `rustc_query_append`.
// invoked by `rustc_with_all_queries`.
macro_rules! define_queries {
(
$($(#[$attr:meta])*