about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKartavya Vashishtha <sendtokartavya@gmail.com>2022-11-24 22:32:15 -0800
committerGitHub <noreply@github.com>2022-11-24 22:32:15 -0800
commitf64feeb11ac78db9c634339465d973ceb9cb3c97 (patch)
treedc0996d3219ca41c06733e360b5c9b540138f3fa
parent29951f9766dc8ffc2b661b78cdff44ceafef3d57 (diff)
downloadrust-f64feeb11ac78db9c634339465d973ceb9cb3c97.tar.gz
rust-f64feeb11ac78db9c634339465d973ceb9cb3c97.zip
Correct node traversal to look at parent instead
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
-rw-r--r--crates/ide/src/hover.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 9751dc11db6..5e812a1569c 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -176,8 +176,8 @@ pub(crate) fn hover(
                     return None;
                 }
 
-                let record_pat_field_list =
-                    token.parent_ancestors().find_map(ast::RecordPatFieldList::cast)?;
+                let rest_pat = token.syntax().parent().and_then(ast::RestPat::cast)?;
+                let record_pat_field_list = rest_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast)?;
 
                 let record_pat =
                     record_pat_field_list.syntax().parent().and_then(ast::RecordPat::cast)?;