mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-31 07:37:30 +00:00
Goto definition works for S { a: }
case
What happens here is that we lower `: ` to a missing expression, and then correctly record that the corresponding field expression resolves to a specific field. Where we fail is in the mapping of syntax to this missing expression. Doing it via `ast_field.expr()` fails, as that expression is `None`. Instead, we go in the opposite direcition and ask each lowered field about its source. This works, but has wrong complexity `O(N)` and, really, the implementation is just too complex. We need some better management of data here.
This commit is contained in:
parent
5138baf2ac
commit
af2366acdf
2 changed files with 33 additions and 3 deletions
|
@ -1158,6 +1158,17 @@ struct S;
|
|||
|
||||
//- /m.rs
|
||||
//! [`super::S$0`]
|
||||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goto_incomplete_field() {
|
||||
check(
|
||||
r#"
|
||||
struct A { a: u32 }
|
||||
//^
|
||||
fn foo() { A { a$0: }; }
|
||||
"#,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue