@@ -229,7 +229,7 @@ pub struct TraitData {
229
229
/// method calls to this trait's methods when the receiver is an array and the crate edition is
230
230
/// 2015 or 2018.
231
231
// box it as the vec is usually empty anyways
232
- pub attribute_calls : Option < Box < Vec < ( AstId < ast:: Item > , MacroCallId ) > > > ,
232
+ pub macro_calls : Option < Box < Vec < ( AstId < ast:: Item > , MacroCallId ) > > > ,
233
233
}
234
234
235
235
impl TraitData {
@@ -258,12 +258,12 @@ impl TraitData {
258
258
let mut collector =
259
259
AssocItemCollector :: new ( db, module_id, tree_id. file_id ( ) , ItemContainerId :: TraitId ( tr) ) ;
260
260
collector. collect ( & item_tree, tree_id. tree_id ( ) , & tr_def. items ) ;
261
- let ( items, attribute_calls , diagnostics) = collector. finish ( ) ;
261
+ let ( items, macro_calls , diagnostics) = collector. finish ( ) ;
262
262
263
263
(
264
264
Arc :: new ( TraitData {
265
265
name,
266
- attribute_calls ,
266
+ macro_calls ,
267
267
items,
268
268
is_auto,
269
269
is_unsafe,
@@ -298,7 +298,7 @@ impl TraitData {
298
298
}
299
299
300
300
pub fn attribute_calls ( & self ) -> impl Iterator < Item = ( AstId < ast:: Item > , MacroCallId ) > + ' _ {
301
- self . attribute_calls . iter ( ) . flat_map ( |it| it. iter ( ) ) . copied ( )
301
+ self . macro_calls . iter ( ) . flat_map ( |it| it. iter ( ) ) . copied ( )
302
302
}
303
303
}
304
304
@@ -319,15 +319,15 @@ impl TraitAliasData {
319
319
}
320
320
}
321
321
322
- #[ derive( Debug , Clone , PartialEq , Eq ) ]
322
+ #[ derive( Debug , PartialEq , Eq ) ]
323
323
pub struct ImplData {
324
324
pub target_trait : Option < Interned < TraitRef > > ,
325
325
pub self_ty : Interned < TypeRef > ,
326
326
pub items : Vec < AssocItemId > ,
327
327
pub is_negative : bool ,
328
328
pub is_unsafe : bool ,
329
329
// box it as the vec is usually empty anyways
330
- pub attribute_calls : Option < Box < Vec < ( AstId < ast:: Item > , MacroCallId ) > > > ,
330
+ pub macro_calls : Option < Box < Vec < ( AstId < ast:: Item > , MacroCallId ) > > > ,
331
331
}
332
332
333
333
impl ImplData {
@@ -354,7 +354,7 @@ impl ImplData {
354
354
AssocItemCollector :: new ( db, module_id, tree_id. file_id ( ) , ItemContainerId :: ImplId ( id) ) ;
355
355
collector. collect ( & item_tree, tree_id. tree_id ( ) , & impl_def. items ) ;
356
356
357
- let ( items, attribute_calls , diagnostics) = collector. finish ( ) ;
357
+ let ( items, macro_calls , diagnostics) = collector. finish ( ) ;
358
358
let items = items. into_iter ( ) . map ( |( _, item) | item) . collect ( ) ;
359
359
360
360
(
@@ -364,14 +364,14 @@ impl ImplData {
364
364
items,
365
365
is_negative,
366
366
is_unsafe,
367
- attribute_calls ,
367
+ macro_calls ,
368
368
} ) ,
369
369
DefDiagnostics :: new ( diagnostics) ,
370
370
)
371
371
}
372
372
373
373
pub fn attribute_calls ( & self ) -> impl Iterator < Item = ( AstId < ast:: Item > , MacroCallId ) > + ' _ {
374
- self . attribute_calls . iter ( ) . flat_map ( |it| it. iter ( ) ) . copied ( )
374
+ self . macro_calls . iter ( ) . flat_map ( |it| it. iter ( ) ) . copied ( )
375
375
}
376
376
}
377
377
@@ -573,7 +573,7 @@ struct AssocItemCollector<'a> {
573
573
expander : Expander ,
574
574
575
575
items : Vec < ( Name , AssocItemId ) > ,
576
- attr_calls : Vec < ( AstId < ast:: Item > , MacroCallId ) > ,
576
+ macro_calls : Vec < ( AstId < ast:: Item > , MacroCallId ) > ,
577
577
}
578
578
579
579
impl < ' a > AssocItemCollector < ' a > {
@@ -590,7 +590,7 @@ impl<'a> AssocItemCollector<'a> {
590
590
container,
591
591
expander : Expander :: new ( db, file_id, module_id) ,
592
592
items : Vec :: new ( ) ,
593
- attr_calls : Vec :: new ( ) ,
593
+ macro_calls : Vec :: new ( ) ,
594
594
diagnostics : Vec :: new ( ) ,
595
595
}
596
596
}
@@ -604,7 +604,7 @@ impl<'a> AssocItemCollector<'a> {
604
604
) {
605
605
(
606
606
self . items ,
607
- if self . attr_calls . is_empty ( ) { None } else { Some ( Box :: new ( self . attr_calls ) ) } ,
607
+ if self . macro_calls . is_empty ( ) { None } else { Some ( Box :: new ( self . macro_calls ) ) } ,
608
608
self . diagnostics ,
609
609
)
610
610
}
@@ -662,11 +662,11 @@ impl<'a> AssocItemCollector<'a> {
662
662
}
663
663
}
664
664
665
- self . attr_calls . push ( ( ast_id, call_id) ) ;
665
+ self . macro_calls . push ( ( ast_id, call_id) ) ;
666
666
667
667
let res =
668
668
self . expander . enter_expand_id :: < ast:: MacroItems > ( self . db , call_id) ;
669
- self . collect_macro_items ( res, & || loc . kind . clone ( ) ) ;
669
+ self . collect_macro_items ( res) ;
670
670
continue ' items;
671
671
}
672
672
Ok ( _) => ( ) ,
@@ -743,11 +743,8 @@ impl<'a> AssocItemCollector<'a> {
743
743
Ok ( Some ( call_id) ) => {
744
744
let res =
745
745
self . expander . enter_expand_id :: < ast:: MacroItems > ( self . db , call_id) ;
746
- self . collect_macro_items ( res, & || hir_expand:: MacroCallKind :: FnLike {
747
- ast_id : InFile :: new ( file_id, ast_id) ,
748
- expand_to : hir_expand:: ExpandTo :: Items ,
749
- eager : None ,
750
- } ) ;
746
+ self . macro_calls . push ( ( InFile :: new ( file_id, ast_id. upcast ( ) ) , call_id) ) ;
747
+ self . collect_macro_items ( res) ;
751
748
}
752
749
Ok ( None ) => ( ) ,
753
750
Err ( _) => {
@@ -766,39 +763,8 @@ impl<'a> AssocItemCollector<'a> {
766
763
}
767
764
}
768
765
769
- fn collect_macro_items (
770
- & mut self ,
771
- ExpandResult { value, err } : ExpandResult < Option < ( Mark , Parse < ast:: MacroItems > ) > > ,
772
- error_call_kind : & dyn Fn ( ) -> hir_expand:: MacroCallKind ,
773
- ) {
774
- let Some ( ( mark, parse) ) = value else { return } ;
775
-
776
- if let Some ( err) = err {
777
- let diag = match err {
778
- // why is this reported here?
779
- hir_expand:: ExpandError :: UnresolvedProcMacro ( krate) => {
780
- DefDiagnostic :: unresolved_proc_macro (
781
- self . module_id . local_id ,
782
- error_call_kind ( ) ,
783
- krate,
784
- )
785
- }
786
- _ => DefDiagnostic :: macro_error (
787
- self . module_id . local_id ,
788
- error_call_kind ( ) ,
789
- err. to_string ( ) ,
790
- ) ,
791
- } ;
792
- self . diagnostics . push ( diag) ;
793
- }
794
- let errors = parse. errors ( ) ;
795
- if !errors. is_empty ( ) {
796
- self . diagnostics . push ( DefDiagnostic :: macro_expansion_parse_error (
797
- self . module_id . local_id ,
798
- error_call_kind ( ) ,
799
- errors. into_boxed_slice ( ) ,
800
- ) ) ;
801
- }
766
+ fn collect_macro_items ( & mut self , res : ExpandResult < Option < ( Mark , Parse < ast:: MacroItems > ) > > ) {
767
+ let Some ( ( mark, _parse) ) = res. value else { return } ;
802
768
803
769
let tree_id = item_tree:: TreeId :: new ( self . expander . current_file_id ( ) , None ) ;
804
770
let item_tree = tree_id. item_tree ( self . db ) ;
0 commit comments