@@ -229,7 +229,7 @@ pub struct TraitData {
229229 /// method calls to this trait's methods when the receiver is an array and the crate edition is
230230 /// 2015 or 2018.
231231 // 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 ) > > > ,
233233}
234234
235235impl TraitData {
@@ -258,12 +258,12 @@ impl TraitData {
258258 let mut collector =
259259 AssocItemCollector :: new ( db, module_id, tree_id. file_id ( ) , ItemContainerId :: TraitId ( tr) ) ;
260260 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 ( ) ;
262262
263263 (
264264 Arc :: new ( TraitData {
265265 name,
266- attribute_calls ,
266+ macro_calls ,
267267 items,
268268 is_auto,
269269 is_unsafe,
@@ -298,7 +298,7 @@ impl TraitData {
298298 }
299299
300300 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 ( )
302302 }
303303}
304304
@@ -319,15 +319,15 @@ impl TraitAliasData {
319319 }
320320}
321321
322- #[ derive( Debug , Clone , PartialEq , Eq ) ]
322+ #[ derive( Debug , PartialEq , Eq ) ]
323323pub struct ImplData {
324324 pub target_trait : Option < Interned < TraitRef > > ,
325325 pub self_ty : Interned < TypeRef > ,
326326 pub items : Vec < AssocItemId > ,
327327 pub is_negative : bool ,
328328 pub is_unsafe : bool ,
329329 // 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 ) > > > ,
331331}
332332
333333impl ImplData {
@@ -354,7 +354,7 @@ impl ImplData {
354354 AssocItemCollector :: new ( db, module_id, tree_id. file_id ( ) , ItemContainerId :: ImplId ( id) ) ;
355355 collector. collect ( & item_tree, tree_id. tree_id ( ) , & impl_def. items ) ;
356356
357- let ( items, attribute_calls , diagnostics) = collector. finish ( ) ;
357+ let ( items, macro_calls , diagnostics) = collector. finish ( ) ;
358358 let items = items. into_iter ( ) . map ( |( _, item) | item) . collect ( ) ;
359359
360360 (
@@ -364,14 +364,14 @@ impl ImplData {
364364 items,
365365 is_negative,
366366 is_unsafe,
367- attribute_calls ,
367+ macro_calls ,
368368 } ) ,
369369 DefDiagnostics :: new ( diagnostics) ,
370370 )
371371 }
372372
373373 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 ( )
375375 }
376376}
377377
@@ -573,7 +573,7 @@ struct AssocItemCollector<'a> {
573573 expander : Expander ,
574574
575575 items : Vec < ( Name , AssocItemId ) > ,
576- attr_calls : Vec < ( AstId < ast:: Item > , MacroCallId ) > ,
576+ macro_calls : Vec < ( AstId < ast:: Item > , MacroCallId ) > ,
577577}
578578
579579impl < ' a > AssocItemCollector < ' a > {
@@ -590,7 +590,7 @@ impl<'a> AssocItemCollector<'a> {
590590 container,
591591 expander : Expander :: new ( db, file_id, module_id) ,
592592 items : Vec :: new ( ) ,
593- attr_calls : Vec :: new ( ) ,
593+ macro_calls : Vec :: new ( ) ,
594594 diagnostics : Vec :: new ( ) ,
595595 }
596596 }
@@ -604,7 +604,7 @@ impl<'a> AssocItemCollector<'a> {
604604 ) {
605605 (
606606 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 ) ) } ,
608608 self . diagnostics ,
609609 )
610610 }
@@ -662,11 +662,11 @@ impl<'a> AssocItemCollector<'a> {
662662 }
663663 }
664664
665- self . attr_calls . push ( ( ast_id, call_id) ) ;
665+ self . macro_calls . push ( ( ast_id, call_id) ) ;
666666
667667 let res =
668668 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) ;
670670 continue ' items;
671671 }
672672 Ok ( _) => ( ) ,
@@ -743,11 +743,8 @@ impl<'a> AssocItemCollector<'a> {
743743 Ok ( Some ( call_id) ) => {
744744 let res =
745745 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) ;
751748 }
752749 Ok ( None ) => ( ) ,
753750 Err ( _) => {
@@ -766,39 +763,8 @@ impl<'a> AssocItemCollector<'a> {
766763 }
767764 }
768765
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 } ;
802768
803769 let tree_id = item_tree:: TreeId :: new ( self . expander . current_file_id ( ) , None ) ;
804770 let item_tree = tree_id. item_tree ( self . db ) ;
0 commit comments