Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/nameres/attr_resolution.rs')
| -rw-r--r-- | crates/hir-def/src/nameres/attr_resolution.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/hir-def/src/nameres/attr_resolution.rs b/crates/hir-def/src/nameres/attr_resolution.rs index eb7f4c05ae..e2d83c8e3b 100644 --- a/crates/hir-def/src/nameres/attr_resolution.rs +++ b/crates/hir-def/src/nameres/attr_resolution.rs @@ -3,7 +3,7 @@ use base_db::CrateId; use hir_expand::{ attrs::{Attr, AttrId, AttrInput}, - MacroCallId, MacroCallKind, MacroDefId, + AstId, MacroCallId, MacroCallKind, MacroDefId, }; use span::SyntaxContextId; use syntax::{ast, SmolStr}; @@ -98,7 +98,20 @@ impl DefMap { false } } - +pub(super) fn derive_attr_macro_as_call_id( + db: &dyn DefDatabase, + item_attr: &AstId<ast::Adt>, + macro_attr: &Attr, + krate: CrateId, + def: MacroDefId, +) -> MacroCallId { + def.make_call( + db.upcast(), + krate, + MacroCallKind::DeriveAttr { ast_id: *item_attr, invoc_attr_index: macro_attr.id }, + macro_attr.ctxt, + ) +} pub(super) fn attr_macro_as_call_id( db: &dyn DefDatabase, item_attr: &AstIdWithPath<ast::Item>, |