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/ide/src/display/navigation_target.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'crates/ide/src/display') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 234f80a3a..73fc73619 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -176,7 +176,15 @@ impl ToNav for FileSymbol { impl TryToNav for Definition { fn try_to_nav(&self, db: &RootDatabase) -> Option { match self { - Definition::Macro(it) => Some(it.to_nav(db)), + Definition::Macro(it) => { + // 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 it.is_proc_macro() { + return None; + } + Some(it.to_nav(db)) + } Definition::Field(it) => Some(it.to_nav(db)), Definition::ModuleDef(it) => it.try_to_nav(db), Definition::SelfType(it) => Some(it.to_nav(db)), -- cgit v1.2.3