aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/display
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-18 02:30:51 +0000
committerGitHub <[email protected]>2020-12-18 02:30:51 +0000
commitf4929fa9ccd0eda65c2b77fef163c31e33bfb89a (patch)
tree9c0a7983908c81e13dbc4526f910e89360bb1ce8 /crates/ide/src/display
parent37e5f19373d6e4d639d0ee1125741f7b5c5c5b1a (diff)
parent60a3785ac27d7361617977bd53e11f2859e97c7c (diff)
Merge #6901
6901: Temp fixes panic caused by no ast for proc-macro r=maklad a=edwin0cheng There are some panic when hover/goto definition for proc-macro. It is because in current design, we don't have `ast-node` for proc-macro and then it trigger [this](https://github.com/rust-analyzer/rust-analyzer/blob/479d1f7eec22c3564867223e2093f14774092528/crates/hir/src/has_source.rs#L116) line to panic. This PR is a temp fix for all of these similar to https://github.com/rust-analyzer/rust-analyzer/blob/bd4c352831662762ee7a66da77ec9adf623b0a0a/crates/completion/src/render/macro_.rs#L42 Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r--crates/ide/src/display/navigation_target.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index 522607cb7..48acb8c93 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -155,7 +155,15 @@ impl ToNav for FileSymbol {
155impl TryToNav for Definition { 155impl TryToNav for Definition {
156 fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { 156 fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> {
157 match self { 157 match self {
158 Definition::Macro(it) => Some(it.to_nav(db)), 158 Definition::Macro(it) => {
159 // FIXME: Currently proc-macro do not have ast-node,
160 // such that it does not have source
161 // more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913
162 if it.is_proc_macro() {
163 return None;
164 }
165 Some(it.to_nav(db))
166 }
159 Definition::Field(it) => Some(it.to_nav(db)), 167 Definition::Field(it) => Some(it.to_nav(db)),
160 Definition::ModuleDef(it) => it.try_to_nav(db), 168 Definition::ModuleDef(it) => it.try_to_nav(db),
161 Definition::SelfType(it) => Some(it.to_nav(db)), 169 Definition::SelfType(it) => Some(it.to_nav(db)),