@@ -234,11 +234,10 @@ macro_rules! get_provider {
234
234
}
235
235
236
236
macro_rules! define_queries {
237
- ( <$tcx : tt>
237
+ (
238
238
$( $( #[ $attr: meta] ) *
239
239
[ $( $modifiers: tt) * ] fn $name: ident( $( $K: tt) * ) -> $V: ty, ) * ) => {
240
240
define_queries_struct! {
241
- tcx: $tcx,
242
241
input: ( $( ( [ $( $modifiers) * ] [ $( $attr) * ] [ $name] ) ) * )
243
242
}
244
243
@@ -247,7 +246,7 @@ macro_rules! define_queries {
247
246
248
247
// Create an eponymous constructor for each query.
249
248
$( #[ 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 {
251
250
let kind = dep_graph:: DepKind :: $name;
252
251
let name = stringify!( $name) ;
253
252
// Disable visible paths printing for performance reasons.
@@ -295,40 +294,40 @@ macro_rules! define_queries {
295
294
mod queries {
296
295
use std:: marker:: PhantomData ;
297
296
298
- $( pub struct $name<$ tcx> {
299
- data: PhantomData <& $ tcx ( ) >
297
+ $( pub struct $name<' tcx> {
298
+ data: PhantomData <& ' tcx ( ) >
300
299
} ) *
301
300
}
302
301
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>;
307
306
const NAME : & ' static str = stringify!( $name) ;
308
307
}
309
308
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> }
312
311
313
- type Cache = query_storage:: $name<$ tcx>;
312
+ type Cache = query_storage:: $name<' tcx>;
314
313
315
314
#[ 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
318
317
{
319
318
& tcx. queries. $name
320
319
}
321
320
322
321
#[ inline( always) ]
323
- fn query_cache<' a>( tcx: QueryCtxt <$ tcx>) -> & ' a Self :: Cache
322
+ fn query_cache<' a>( tcx: QueryCtxt <' tcx>) -> & ' a Self :: Cache
324
323
where ' tcx: ' a
325
324
{
326
325
& tcx. query_caches. $name
327
326
}
328
327
329
328
#[ inline]
330
329
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 >
332
331
{
333
332
let compute = get_provider!( [ $( $modifiers) * ] [ tcx, $name, key] ) ;
334
333
let cache_on_disk = Self :: cache_on_disk( tcx. tcx, key) ;
@@ -465,28 +464,25 @@ macro_rules! define_queries {
465
464
}
466
465
}
467
466
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).
471
467
macro_rules! define_queries_struct {
472
- ( tcx : $tcx : tt ,
468
+ (
473
469
input: ( $( ( [ $( $modifiers: tt) * ] [ $( $attr: tt) * ] [ $name: ident] ) ) * ) ) => {
474
- pub struct Queries <$ tcx> {
470
+ pub struct Queries <' tcx> {
475
471
local_providers: Box <Providers >,
476
472
extern_providers: Box <ExternProviders >,
477
473
478
- pub on_disk_cache: Option <OnDiskCache <$ tcx>>,
474
+ pub on_disk_cache: Option <OnDiskCache <' tcx>>,
479
475
480
476
jobs: AtomicU64 ,
481
477
482
- $( $( #[ $attr] ) * $name: QueryState <query_keys:: $name<$ tcx>>, ) *
478
+ $( $( #[ $attr] ) * $name: QueryState <query_keys:: $name<' tcx>>, ) *
483
479
}
484
480
485
- impl <$ tcx> Queries <$ tcx> {
481
+ impl <' tcx> Queries <' tcx> {
486
482
pub fn new(
487
483
local_providers: Providers ,
488
484
extern_providers: ExternProviders ,
489
- on_disk_cache: Option <OnDiskCache <$ tcx>>,
485
+ on_disk_cache: Option <OnDiskCache <' tcx>>,
490
486
) -> Self {
491
487
Queries {
492
488
local_providers: Box :: new( local_providers) ,
@@ -498,8 +494,8 @@ macro_rules! define_queries_struct {
498
494
}
499
495
500
496
pub ( crate ) fn try_collect_active_jobs(
501
- & $ tcx self ,
502
- tcx: TyCtxt <$ tcx>,
497
+ & ' tcx self ,
498
+ tcx: TyCtxt <' tcx>,
503
499
) -> Option <QueryMap > {
504
500
let tcx = QueryCtxt { tcx, queries: self } ;
505
501
let mut jobs = QueryMap :: default ( ) ;
@@ -532,13 +528,13 @@ macro_rules! define_queries_struct {
532
528
#[ tracing:: instrument( level = "trace" , skip( self , tcx) ) ]
533
529
fn $name(
534
530
& ' tcx self ,
535
- tcx: TyCtxt <$ tcx>,
531
+ tcx: TyCtxt <' tcx>,
536
532
span: Span ,
537
- key: query_keys:: $name<$ tcx>,
533
+ key: query_keys:: $name<' tcx>,
538
534
mode: QueryMode ,
539
- ) -> Option <query_stored:: $name<$ tcx>> {
535
+ ) -> Option <query_stored:: $name<' tcx>> {
540
536
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)
542
538
} ) *
543
539
}
544
540
} ;
0 commit comments