@@ -234,11 +234,10 @@ macro_rules! get_provider {
234234}
235235
236236macro_rules! define_queries {
237- ( <$tcx : tt>
237+ (
238238 $( $( #[ $attr: meta] ) *
239239 [ $( $modifiers: tt) * ] fn $name: ident( $( $K: tt) * ) -> $V: ty, ) * ) => {
240240 define_queries_struct! {
241- tcx: $tcx,
242241 input: ( $( ( [ $( $modifiers) * ] [ $( $attr) * ] [ $name] ) ) * )
243242 }
244243
@@ -247,7 +246,7 @@ macro_rules! define_queries {
247246
248247 // Create an eponymous constructor for each query.
249248 $( #[ allow( nonstandard_style) ] $( #[ $attr] ) *
250- pub fn $name<$ tcx>( tcx: QueryCtxt <$ tcx>, key: query_keys:: $name<$ tcx>) -> QueryStackFrame {
249+ pub fn $name<' tcx>( tcx: QueryCtxt <' tcx>, key: query_keys:: $name<' tcx>) -> QueryStackFrame {
251250 let kind = dep_graph:: DepKind :: $name;
252251 let name = stringify!( $name) ;
253252 // Disable visible paths printing for performance reasons.
@@ -295,40 +294,40 @@ macro_rules! define_queries {
295294 mod queries {
296295 use std:: marker:: PhantomData ;
297296
298- $( pub struct $name<$ tcx> {
299- data: PhantomData <& $ tcx ( ) >
297+ $( pub struct $name<' tcx> {
298+ data: PhantomData <& ' tcx ( ) >
300299 } ) *
301300 }
302301
303- $( impl <$ tcx> QueryConfig for queries:: $name<$ tcx> {
304- type Key = query_keys:: $name<$ tcx>;
305- type Value = query_values:: $name<$ tcx>;
306- type Stored = query_stored:: $name<$ tcx>;
302+ $( impl <' tcx> QueryConfig for queries:: $name<' tcx> {
303+ type Key = query_keys:: $name<' tcx>;
304+ type Value = query_values:: $name<' tcx>;
305+ type Stored = query_stored:: $name<' tcx>;
307306 const NAME : & ' static str = stringify!( $name) ;
308307 }
309308
310- impl <$ tcx> QueryDescription <QueryCtxt <$ tcx>> for queries:: $name<$ tcx> {
311- rustc_query_description! { $name<$ tcx> }
309+ impl <' tcx> QueryDescription <QueryCtxt <' tcx>> for queries:: $name<' tcx> {
310+ rustc_query_description! { $name<' tcx> }
312311
313- type Cache = query_storage:: $name<$ tcx>;
312+ type Cache = query_storage:: $name<' tcx>;
314313
315314 #[ inline( always) ]
316- fn query_state<' a>( tcx: QueryCtxt <$ tcx>) -> & ' a QueryState <Self :: Key >
317- where QueryCtxt <$ tcx>: ' a
315+ fn query_state<' a>( tcx: QueryCtxt <' tcx>) -> & ' a QueryState <Self :: Key >
316+ where QueryCtxt <' tcx>: ' a
318317 {
319318 & tcx. queries. $name
320319 }
321320
322321 #[ inline( always) ]
323- fn query_cache<' a>( tcx: QueryCtxt <$ tcx>) -> & ' a Self :: Cache
322+ fn query_cache<' a>( tcx: QueryCtxt <' tcx>) -> & ' a Self :: Cache
324323 where ' tcx: ' a
325324 {
326325 & tcx. query_caches. $name
327326 }
328327
329328 #[ inline]
330329 fn make_vtable( tcx: QueryCtxt <' tcx>, key: & Self :: Key ) ->
331- QueryVTable <QueryCtxt <$ tcx>, Self :: Key , Self :: Value >
330+ QueryVTable <QueryCtxt <' tcx>, Self :: Key , Self :: Value >
332331 {
333332 let compute = get_provider!( [ $( $modifiers) * ] [ tcx, $name, key] ) ;
334333 let cache_on_disk = Self :: cache_on_disk( tcx. tcx, key) ;
@@ -465,28 +464,25 @@ macro_rules! define_queries {
465464 }
466465}
467466
468- // FIXME(eddyb) this macro (and others?) use `$tcx` and `'tcx` interchangeably.
469- // We should either not take `$tcx` at all and use `'tcx` everywhere, or use
470- // `$tcx` everywhere (even if that isn't necessary due to lack of hygiene).
471467macro_rules! define_queries_struct {
472- ( tcx : $tcx : tt ,
468+ (
473469 input: ( $( ( [ $( $modifiers: tt) * ] [ $( $attr: tt) * ] [ $name: ident] ) ) * ) ) => {
474- pub struct Queries <$ tcx> {
470+ pub struct Queries <' tcx> {
475471 local_providers: Box <Providers >,
476472 extern_providers: Box <ExternProviders >,
477473
478- pub on_disk_cache: Option <OnDiskCache <$ tcx>>,
474+ pub on_disk_cache: Option <OnDiskCache <' tcx>>,
479475
480476 jobs: AtomicU64 ,
481477
482- $( $( #[ $attr] ) * $name: QueryState <query_keys:: $name<$ tcx>>, ) *
478+ $( $( #[ $attr] ) * $name: QueryState <query_keys:: $name<' tcx>>, ) *
483479 }
484480
485- impl <$ tcx> Queries <$ tcx> {
481+ impl <' tcx> Queries <' tcx> {
486482 pub fn new(
487483 local_providers: Providers ,
488484 extern_providers: ExternProviders ,
489- on_disk_cache: Option <OnDiskCache <$ tcx>>,
485+ on_disk_cache: Option <OnDiskCache <' tcx>>,
490486 ) -> Self {
491487 Queries {
492488 local_providers: Box :: new( local_providers) ,
@@ -498,8 +494,8 @@ macro_rules! define_queries_struct {
498494 }
499495
500496 pub ( crate ) fn try_collect_active_jobs(
501- & $ tcx self ,
502- tcx: TyCtxt <$ tcx>,
497+ & ' tcx self ,
498+ tcx: TyCtxt <' tcx>,
503499 ) -> Option <QueryMap > {
504500 let tcx = QueryCtxt { tcx, queries: self } ;
505501 let mut jobs = QueryMap :: default ( ) ;
@@ -532,13 +528,13 @@ macro_rules! define_queries_struct {
532528 #[ tracing:: instrument( level = "trace" , skip( self , tcx) ) ]
533529 fn $name(
534530 & ' tcx self ,
535- tcx: TyCtxt <$ tcx>,
531+ tcx: TyCtxt <' tcx>,
536532 span: Span ,
537- key: query_keys:: $name<$ tcx>,
533+ key: query_keys:: $name<' tcx>,
538534 mode: QueryMode ,
539- ) -> Option <query_stored:: $name<$ tcx>> {
535+ ) -> Option <query_stored:: $name<' tcx>> {
540536 let qcx = QueryCtxt { tcx, queries: self } ;
541- get_query:: <queries:: $name<$ tcx>, _>( qcx, span, key, mode)
537+ get_query:: <queries:: $name<' tcx>, _>( qcx, span, key, mode)
542538 } ) *
543539 }
544540 } ;
0 commit comments