From 60a3785ac27d7361617977bd53e11f2859e97c7c Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 18 Dec 2020 10:26:17 +0800 Subject: Temp fixes panic caused by no ast for proc-macro --- crates/hir/src/code_model.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/hir/src') 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 { /// XXX: this parses the file pub fn name(self, db: &dyn HirDatabase) -> Option { + // FIXME: Currently proc-macro do not have ast-node, + // such that it does not have source + // more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913 + if self.is_proc_macro() { + return None; + } self.source(db).value.name().map(|it| it.as_name()) } -- cgit v1.2.3