mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Auto merge of #13897 - bvanjoi:nearest-block-search, r=Veykril
fix(ty): should query impls in nearest block fix https://github.com/rust-lang/rust-analyzer/issues/13895
This commit is contained in:
commit
75877d78d9
2 changed files with 71 additions and 2 deletions
|
@ -1916,4 +1916,68 @@ fn main() {
|
|||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn query_impls_in_nearest_block() {
|
||||
check(
|
||||
r#"
|
||||
struct S1;
|
||||
impl S1 {
|
||||
fn e() -> () {}
|
||||
}
|
||||
fn f1() {
|
||||
struct S1;
|
||||
impl S1 {
|
||||
fn e() -> () {}
|
||||
//^
|
||||
}
|
||||
fn f2() {
|
||||
fn f3() {
|
||||
S1::e$0();
|
||||
}
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
||||
check(
|
||||
r#"
|
||||
struct S1;
|
||||
impl S1 {
|
||||
fn e() -> () {}
|
||||
}
|
||||
fn f1() {
|
||||
struct S1;
|
||||
impl S1 {
|
||||
fn e() -> () {}
|
||||
//^
|
||||
}
|
||||
fn f2() {
|
||||
struct S2;
|
||||
S1::e$0();
|
||||
}
|
||||
}
|
||||
fn f12() {
|
||||
struct S1;
|
||||
impl S1 {
|
||||
fn e() -> () {}
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
||||
check(
|
||||
r#"
|
||||
struct S1;
|
||||
impl S1 {
|
||||
fn e() -> () {}
|
||||
//^
|
||||
}
|
||||
fn f2() {
|
||||
struct S2;
|
||||
S1::e$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue