@@ -189,25 +189,6 @@ impl<T: Parse> Parse for List<T> {
189
189
}
190
190
}
191
191
192
- /// A named group containing queries.
193
- ///
194
- /// For now, the name is not used any more, but the capability remains interesting for future
195
- /// developments of the query system.
196
- struct Group {
197
- #[ allow( unused) ]
198
- name : Ident ,
199
- queries : List < Query > ,
200
- }
201
-
202
- impl Parse for Group {
203
- fn parse ( input : ParseStream < ' _ > ) -> Result < Self > {
204
- let name: Ident = input. parse ( ) ?;
205
- let content;
206
- braced ! ( content in input) ;
207
- Ok ( Group { name, queries : content. parse ( ) ? } )
208
- }
209
- }
210
-
211
192
struct QueryModifiers {
212
193
/// The description of the query.
213
194
desc : ( Option < Ident > , Punctuated < Expr , Token ! [ , ] > ) ,
@@ -450,72 +431,70 @@ fn add_query_description_impl(
450
431
}
451
432
452
433
pub fn rustc_queries ( input : TokenStream ) -> TokenStream {
453
- let groups = parse_macro_input ! ( input as List <Group >) ;
434
+ let queries = parse_macro_input ! ( input as List <Query >) ;
454
435
455
436
let mut query_stream = quote ! { } ;
456
437
let mut query_description_stream = quote ! { } ;
457
438
let mut dep_node_def_stream = quote ! { } ;
458
439
let mut cached_queries = quote ! { } ;
459
440
460
- for group in groups. 0 {
461
- for mut query in group. queries . 0 {
462
- let modifiers = process_modifiers ( & mut query) ;
463
- let name = & query. name ;
464
- let arg = & query. arg ;
465
- let result_full = & query. result ;
466
- let result = match query. result {
467
- ReturnType :: Default => quote ! { -> ( ) } ,
468
- _ => quote ! { #result_full } ,
469
- } ;
441
+ for mut query in queries. 0 {
442
+ let modifiers = process_modifiers ( & mut query) ;
443
+ let name = & query. name ;
444
+ let arg = & query. arg ;
445
+ let result_full = & query. result ;
446
+ let result = match query. result {
447
+ ReturnType :: Default => quote ! { -> ( ) } ,
448
+ _ => quote ! { #result_full } ,
449
+ } ;
470
450
471
- if modifiers. cache . is_some ( ) {
472
- cached_queries. extend ( quote ! {
473
- #name,
474
- } ) ;
475
- }
451
+ if modifiers. cache . is_some ( ) {
452
+ cached_queries. extend ( quote ! {
453
+ #name,
454
+ } ) ;
455
+ }
476
456
477
- let mut attributes = Vec :: new ( ) ;
457
+ let mut attributes = Vec :: new ( ) ;
478
458
479
- // Pass on the fatal_cycle modifier
480
- if modifiers. fatal_cycle {
481
- attributes. push ( quote ! { fatal_cycle } ) ;
482
- } ;
483
- // Pass on the storage modifier
484
- if let Some ( ref ty) = modifiers. storage {
485
- attributes. push ( quote ! { storage( #ty) } ) ;
486
- } ;
487
- // Pass on the cycle_delay_bug modifier
488
- if modifiers. cycle_delay_bug {
489
- attributes. push ( quote ! { cycle_delay_bug } ) ;
490
- } ;
491
- // Pass on the no_hash modifier
492
- if modifiers. no_hash {
493
- attributes. push ( quote ! { no_hash } ) ;
494
- } ;
495
- // Pass on the anon modifier
496
- if modifiers. anon {
497
- attributes. push ( quote ! { anon } ) ;
498
- } ;
499
- // Pass on the eval_always modifier
500
- if modifiers. eval_always {
501
- attributes. push ( quote ! { eval_always } ) ;
502
- } ;
459
+ // Pass on the fatal_cycle modifier
460
+ if modifiers. fatal_cycle {
461
+ attributes. push ( quote ! { fatal_cycle } ) ;
462
+ } ;
463
+ // Pass on the storage modifier
464
+ if let Some ( ref ty) = modifiers. storage {
465
+ attributes. push ( quote ! { storage( #ty) } ) ;
466
+ } ;
467
+ // Pass on the cycle_delay_bug modifier
468
+ if modifiers. cycle_delay_bug {
469
+ attributes. push ( quote ! { cycle_delay_bug } ) ;
470
+ } ;
471
+ // Pass on the no_hash modifier
472
+ if modifiers. no_hash {
473
+ attributes. push ( quote ! { no_hash } ) ;
474
+ } ;
475
+ // Pass on the anon modifier
476
+ if modifiers. anon {
477
+ attributes. push ( quote ! { anon } ) ;
478
+ } ;
479
+ // Pass on the eval_always modifier
480
+ if modifiers. eval_always {
481
+ attributes. push ( quote ! { eval_always } ) ;
482
+ } ;
503
483
504
- let attribute_stream = quote ! { #( #attributes) , * } ;
505
- let doc_comments = query. doc_comments . iter ( ) ;
506
- // Add the query to the group
507
- query_stream. extend ( quote ! {
508
- #( #doc_comments) *
509
- [ #attribute_stream] fn #name( #arg) #result,
510
- } ) ;
484
+ let attribute_stream = quote ! { #( #attributes) , * } ;
485
+ let doc_comments = query. doc_comments . iter ( ) ;
486
+ // Add the query to the group
487
+ query_stream. extend ( quote ! {
488
+ #( #doc_comments) *
489
+ [ #attribute_stream] fn #name( #arg) #result,
490
+ } ) ;
511
491
512
- // Create a dep node for the query
513
- dep_node_def_stream. extend ( quote ! {
514
- [ #attribute_stream] #name( #arg) ,
515
- } ) ;
492
+ // Create a dep node for the query
493
+ dep_node_def_stream. extend ( quote ! {
494
+ [ #attribute_stream] #name( #arg) ,
495
+ } ) ;
516
496
517
- add_query_description_impl ( & query, modifiers, & mut query_description_stream) ;
518
- }
497
+ add_query_description_impl ( & query, modifiers, & mut query_description_stream) ;
519
498
}
520
499
521
500
TokenStream :: from ( quote ! {
0 commit comments