Declare rustc_with_all_queries! as macros-2.0

Unlike `macro_rules!`, macros-2.0 macros have sensible item-like namespacing
and visibility by default, which avoids the need for `#[macro_export]` and
makes it easier to import the macro.

The tradeoff is having to use `#[rustc_macro_transparency = "semiopaque"]` to
still get macro-rules hygiene, because macros-2.0 hygiene is too strict here.
This commit is contained in:
Zalathar
2026-03-15 13:17:09 +11:00
parent 1038ed1bbc
commit e8ebfcaa2e
3 changed files with 4 additions and 7 deletions
@@ -179,7 +179,7 @@ fn $name:ident($K:ty) -> $V:ty
// Create an array of vtables, one for each dep kind (non-query and query).
pub fn make_dep_kind_vtables<'tcx>(arena: &'tcx Arena<'tcx>) -> &'tcx [DepKindVTable<'tcx>] {
let (nq_vtables, q_vtables) =
rustc_middle::rustc_with_all_queries! { define_dep_kind_vtables! };
rustc_middle::queries::rustc_with_all_queries! { define_dep_kind_vtables! };
// Non-query vtables must come before query vtables, to match the order of `DepKind`.
arena.alloc_from_iter(nq_vtables.into_iter().chain(q_vtables.into_iter()))
+1 -1
View File
@@ -272,4 +272,4 @@ macro_rules! for_each_query_vtable {
}
}
rustc_middle::rustc_with_all_queries! { define_queries! }
rustc_middle::queries::rustc_with_all_queries! { define_queries! }