diff options
author | Edwin Cheng <[email protected]> | 2020-12-18 02:26:17 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-12-18 02:26:17 +0000 |
commit | 60a3785ac27d7361617977bd53e11f2859e97c7c (patch) | |
tree | b79241db7008f95204b42e45a41dcbc4d07bda99 /crates/hir | |
parent | c1c36acb025880c742c65f436a61fd87fc627eb0 (diff) |
Temp fixes panic caused by no ast for proc-macro
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/code_model.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 42dc35b76..7ffa79996 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -977,6 +977,12 @@ impl MacroDef { | |||
977 | 977 | ||
978 | /// XXX: this parses the file | 978 | /// XXX: this parses the file |
979 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { | 979 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { |
980 | // FIXME: Currently proc-macro do not have ast-node, | ||
981 | // such that it does not have source | ||
982 | // more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913 | ||
983 | if self.is_proc_macro() { | ||
984 | return None; | ||
985 | } | ||
980 | self.source(db).value.name().map(|it| it.as_name()) | 986 | self.source(db).value.name().map(|it| it.as_name()) |
981 | } | 987 | } |
982 | 988 | ||