@@ -12,7 +12,7 @@ use crate::{
1212 db:: DefDatabase ,
1313 intern:: Interned ,
1414 item_tree:: { self , AssocItem , FnFlags , ItemTree , ItemTreeId , ModItem , Param , TreeId } ,
15- nameres:: { attr_resolution:: ResolvedAttr , DefMap } ,
15+ nameres:: { attr_resolution:: ResolvedAttr , proc_macro :: ProcMacroKind , DefMap } ,
1616 type_ref:: { TraitRef , TypeBound , TypeRef } ,
1717 visibility:: RawVisibility ,
1818 AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
@@ -348,7 +348,8 @@ impl MacroRulesData {
348348#[ derive( Debug , Clone , PartialEq , Eq ) ]
349349pub struct ProcMacroData {
350350 pub name : Name ,
351- // FIXME: Record deriver helper here?
351+ /// Derive helpers, if this is a derive
352+ pub helpers : Option < Box < [ Name ] > > ,
352353}
353354
354355impl ProcMacroData {
@@ -360,17 +361,23 @@ impl ProcMacroData {
360361 let item_tree = loc. id . item_tree ( db) ;
361362 let makro = & item_tree[ loc. id . value ] ;
362363
363- let name = if let Some ( def) = item_tree
364+ let ( name, helpers ) = if let Some ( def) = item_tree
364365 . attrs ( db, loc. container . krate ( ) , ModItem :: from ( loc. id . value ) . into ( ) )
365366 . parse_proc_macro_decl ( & makro. name )
366367 {
367- def. name
368+ (
369+ def. name ,
370+ match def. kind {
371+ ProcMacroKind :: CustomDerive { helpers } => Some ( helpers) ,
372+ ProcMacroKind :: FnLike | ProcMacroKind :: Attr => None ,
373+ } ,
374+ )
368375 } else {
369376 // eeeh...
370377 stdx:: never!( "proc macro declaration is not a proc macro" ) ;
371- makro. name . clone ( )
378+ ( makro. name . clone ( ) , None )
372379 } ;
373- Arc :: new ( ProcMacroData { name } )
380+ Arc :: new ( ProcMacroData { name, helpers } )
374381 }
375382}
376383
0 commit comments