diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 19 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 9 |
2 files changed, 6 insertions, 22 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index efa0418ad..5dc3f4128 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -210,15 +210,7 @@ impl ToNav for FileSymbol { | |||
210 | impl TryToNav for Definition { | 210 | impl TryToNav for Definition { |
211 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { | 211 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { |
212 | match self { | 212 | match self { |
213 | Definition::Macro(it) => { | 213 | Definition::Macro(it) => it.try_to_nav(db), |
214 | // FIXME: Currently proc-macro do not have ast-node, | ||
215 | // such that it does not have source | ||
216 | // more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913 | ||
217 | if it.is_proc_macro() { | ||
218 | return None; | ||
219 | } | ||
220 | Some(it.to_nav(db)) | ||
221 | } | ||
222 | Definition::Field(it) => Some(it.to_nav(db)), | 214 | Definition::Field(it) => Some(it.to_nav(db)), |
223 | Definition::ModuleDef(it) => it.try_to_nav(db), | 215 | Definition::ModuleDef(it) => it.try_to_nav(db), |
224 | Definition::SelfType(it) => Some(it.to_nav(db)), | 216 | Definition::SelfType(it) => Some(it.to_nav(db)), |
@@ -366,10 +358,9 @@ impl ToNav for hir::Field { | |||
366 | } | 358 | } |
367 | } | 359 | } |
368 | 360 | ||
369 | impl ToNav for hir::MacroDef { | 361 | impl TryToNav for hir::MacroDef { |
370 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 362 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { |
371 | #[allow(deprecated)] | 363 | let src = self.source(db)?; |
372 | let src = self.source_old(db); | ||
373 | log::debug!("nav target {:#?}", src.value.syntax()); | 364 | log::debug!("nav target {:#?}", src.value.syntax()); |
374 | let mut res = NavigationTarget::from_named( | 365 | let mut res = NavigationTarget::from_named( |
375 | db, | 366 | db, |
@@ -377,7 +368,7 @@ impl ToNav for hir::MacroDef { | |||
377 | SymbolKind::Macro, | 368 | SymbolKind::Macro, |
378 | ); | 369 | ); |
379 | res.docs = self.docs(db); | 370 | res.docs = self.docs(db); |
380 | res | 371 | Some(res) |
381 | } | 372 | } |
382 | } | 373 | } |
383 | 374 | ||
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index c192e3ed7..a18dcdd8e 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -327,14 +327,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
327 | let mod_path = definition_mod_path(db, &def); | 327 | let mod_path = definition_mod_path(db, &def); |
328 | return match def { | 328 | return match def { |
329 | Definition::Macro(it) => { | 329 | Definition::Macro(it) => { |
330 | // FIXME: Currently proc-macro do not have ast-node, | 330 | let label = macro_label(&it.source(db)?.value); |
331 | // such that it does not have source | ||
332 | // more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913 | ||
333 | if it.is_proc_macro() { | ||
334 | return None; | ||
335 | } | ||
336 | #[allow(deprecated)] | ||
337 | let label = macro_label(&it.source_old(db).value); | ||
338 | from_def_source_labeled(db, it, Some(label), mod_path) | 331 | from_def_source_labeled(db, it, Some(label), mod_path) |
339 | } | 332 | } |
340 | Definition::Field(def) => { | 333 | Definition::Field(def) => { |