Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/data.rs')
-rw-r--r--crates/hir_def/src/data.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs
index 5cef7ecb37..bb3a34a7c1 100644
--- a/crates/hir_def/src/data.rs
+++ b/crates/hir_def/src/data.rs
@@ -332,6 +332,7 @@ impl MacroRulesData {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ProcMacroData {
pub name: Name,
+ // FIXME: Record deriver helper here?
}
impl ProcMacroData {
@@ -343,7 +344,17 @@ impl ProcMacroData {
let item_tree = loc.id.item_tree(db);
let makro = &item_tree[loc.id.value];
- Arc::new(ProcMacroData { name: makro.name.clone() })
+ let name = if let Some(def) = item_tree
+ .attrs(db, loc.container.krate(), ModItem::from(loc.id.value).into())
+ .parse_proc_macro_decl(&makro.name)
+ {
+ def.name
+ } else {
+ // eeeh...
+ stdx::never!("proc macro declaration is not a proc macro");
+ makro.name.clone()
+ };
+ Arc::new(ProcMacroData { name })
}
}