Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/lib.rs')
| -rw-r--r-- | crates/hir/src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 17b901d5f8..9c6531da20 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1623,7 +1623,12 @@ impl MacroDef { pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { match self.source(db)?.value { Either::Left(it) => it.name().map(|it| it.as_name()), - Either::Right(it) => it.name().map(|it| it.as_name()), + Either::Right(_) => { + let krate = self.id.krate; + let def_map = db.crate_def_map(krate); + let (_, name) = def_map.exported_proc_macros().find(|&(id, _)| id == self.id)?; + Some(name) + } } } |