summaryrefslogtreecommitdiffstats
path: root/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/rust-analyzer/crates/ide/src/goto_definition.rs')
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/goto_definition.rs54
1 files changed, 52 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
index cf0819a25..4e641357e 100644
--- a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
@@ -113,6 +113,7 @@ fn try_lookup_include_path(
file_id,
full_range: TextRange::new(0.into(), size),
name: path.into(),
+ alias: None,
focus_range: None,
kind: None,
container_name: None,
@@ -833,8 +834,7 @@ fn test() {
#[rustc_builtin_macro]
macro_rules! include {}
- include!("foo.rs");
-//^^^^^^^^^^^^^^^^^^^
+include!("foo.rs");
fn f() {
foo$0();
@@ -846,6 +846,33 @@ mod confuse_index {
//- /foo.rs
fn foo() {}
+ //^^^
+ "#,
+ );
+ }
+
+ #[test]
+ fn goto_through_included_file_struct_with_doc_comment() {
+ check(
+ r#"
+//- /main.rs
+#[rustc_builtin_macro]
+macro_rules! include {}
+
+include!("foo.rs");
+
+fn f() {
+ let x = Foo$0;
+}
+
+mod confuse_index {
+ pub struct Foo;
+}
+
+//- /foo.rs
+/// This is a doc comment
+pub struct Foo;
+ //^^^
"#,
);
}
@@ -1471,6 +1498,29 @@ fn f() {
);
}
#[test]
+ fn method_call_inside_block() {
+ check(
+ r#"
+trait Twait {
+ fn a(&self);
+}
+
+fn outer() {
+ struct Stwuct;
+
+ impl Twait for Stwuct {
+ fn a(&self){}
+ //^
+ }
+ fn f() {
+ let s = Stwuct;
+ s.a$0();
+ }
+}
+ "#,
+ );
+ }
+ #[test]
fn path_call() {
check(
r#"