diff options
| author | bors <bors@rust-lang.org> | 2022-08-04 12:42:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-04 12:42:51 +0000 |
| commit | c6a9fbfd00aa6c587b40ce4dbb58da871b6e8aff (patch) | |
| tree | 490c99034575e8cb29b6aa26c96671c79a2e67da | |
| parent | 4904b2bdf8797f14fff3b585d18207161126acce (diff) | |
| parent | 5698e51027a8f60e0fd7b8ae5f7c077b051197c6 (diff) | |
| download | rust-c6a9fbfd00aa6c587b40ce4dbb58da871b6e8aff.tar.gz rust-c6a9fbfd00aa6c587b40ce4dbb58da871b6e8aff.zip | |
Auto merge of #12939 - jean-santos:errors-ide-hover-wrong-place, r=Veykril
Error Diagnostics appear in the wrong place Fix #12436
| -rw-r--r-- | crates/ide/src/hover.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 59c97f2dcf9..784f85dbbef 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -232,10 +232,12 @@ fn hover_type_fallback( token: &SyntaxToken, original_token: &SyntaxToken, ) -> Option<RangeInfo<HoverResult>> { - let node = token - .parent_ancestors() - .take_while(|it| !ast::Item::can_cast(it.kind())) - .find(|n| ast::Expr::can_cast(n.kind()) || ast::Pat::can_cast(n.kind()))?; + let node = + token.parent_ancestors().take_while(|it| !ast::Item::can_cast(it.kind())).find(|n| { + ast::Expr::can_cast(n.kind()) + || ast::Pat::can_cast(n.kind()) + || ast::Type::can_cast(n.kind()) + })?; let expr_or_pat = match_ast! { match node { |
