@@ -13,7 +13,7 @@ use hir_expand::{
13
13
builtin_macro:: find_builtin_macro,
14
14
name:: { AsName , Name } ,
15
15
proc_macro:: ProcMacroExpander ,
16
- HirFileId , MacroCallId , MacroCallKind , MacroDefId , MacroDefKind ,
16
+ AttrId , HirFileId , MacroCallId , MacroCallKind , MacroDefId , MacroDefKind ,
17
17
} ;
18
18
use hir_expand:: { InFile , MacroCallLoc } ;
19
19
use rustc_hash:: { FxHashMap , FxHashSet } ;
@@ -216,7 +216,7 @@ struct MacroDirective {
216
216
#[ derive( Clone , Debug , Eq , PartialEq ) ]
217
217
enum MacroDirectiveKind {
218
218
FnLike { ast_id : AstIdWithPath < ast:: MacroCall > } ,
219
- Derive { ast_id : AstIdWithPath < ast:: Item > } ,
219
+ Derive { ast_id : AstIdWithPath < ast:: Item > , derive_attr : AttrId } ,
220
220
}
221
221
222
222
struct DefData < ' a > {
@@ -831,10 +831,14 @@ impl DefCollector<'_> {
831
831
Err ( UnresolvedMacro ) | Ok ( Err ( _) ) => { }
832
832
}
833
833
}
834
- MacroDirectiveKind :: Derive { ast_id } => {
835
- match derive_macro_as_call_id ( ast_id, self . db , self . def_map . krate , |path| {
836
- self . resolve_derive_macro ( directive. module_id , & path)
837
- } ) {
834
+ MacroDirectiveKind :: Derive { ast_id, derive_attr } => {
835
+ match derive_macro_as_call_id (
836
+ ast_id,
837
+ * derive_attr,
838
+ self . db ,
839
+ self . def_map . krate ,
840
+ |path| self . resolve_derive_macro ( directive. module_id , & path) ,
841
+ ) {
838
842
Ok ( call_id) => {
839
843
resolved. push ( ( directive. module_id , call_id, directive. depth ) ) ;
840
844
res = ReachedFixedPoint :: No ;
@@ -1368,7 +1372,7 @@ impl ModCollector<'_, '_> {
1368
1372
self . def_collector . unexpanded_macros . push ( MacroDirective {
1369
1373
module_id : self . module_id ,
1370
1374
depth : self . macro_depth + 1 ,
1371
- kind : MacroDirectiveKind :: Derive { ast_id } ,
1375
+ kind : MacroDirectiveKind :: Derive { ast_id, derive_attr : derive . id } ,
1372
1376
} ) ;
1373
1377
}
1374
1378
}
0 commit comments