Get rid of rustc_query_description!

Queries can provide an arbitrary expression for their description and
their caching behavior. Before, these expressions where stored in a
`rustc_query_description` macro emitted by the `rustc_queries` macro,
and then used in `rustc_query_impl` to fill out the methods for the
`QueryDescription` trait.

Instead, we now emit two new modules from `rustc_queries` containing the
functions with the expressions. `rustc_query_impl` calls these functions
now instead of invoking the macro.

Since we are now defining some of the functions in
`rustc_middle::query`, we now need all the imports for the key types
there as well.
This commit is contained in:
Nilstrieb 2022-10-10 20:03:19 +02:00 committed by nils
parent 1566273f48
commit 167b3bd3b2
No known key found for this signature in database
5 changed files with 51 additions and 30 deletions

View file

@ -466,7 +466,14 @@ macro_rules! define_queries {
}
impl<'tcx> QueryDescription<QueryCtxt<'tcx>> for queries::$name<'tcx> {
rustc_query_description! { $name }
fn describe(tcx: QueryCtxt<'tcx>, key: Self::Key) -> String {
::rustc_middle::query::descs::$name(tcx.tcx, key)
}
#[inline]
fn cache_on_disk(tcx: TyCtxt<'tcx>, key: &Self::Key) -> bool {
::rustc_middle::query::cached::$name(tcx, key)
}
type Cache = query_storage::$name<'tcx>;