rust-lang / rust-lang/rust-analyzer
`rust-analyzer lsif` generates non-unique monikers for nested functions
Open
Nobody has claimed this yet.
A-lsif/scip
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
For the following source code:
fn func() {
fn inner_func() {}
}
fn inner_func() {
}
The following LSIF is generated. Monikers are claimed to be scheme-unique, but test::inner_func is not unique.
$ rust-analyzer lsif . | grep vertex | grep moniker
{"id":20,"type":"vertex","label":"moniker","scheme":"rust-analyzer","identifier":"test::crate","unique":"scheme","kind":"export"}
{"id":31,"type":"vertex","label":"moniker","scheme":"rust-analyzer","identifier":"test::func","unique":"scheme","kind":"export"}
{"id":42,"type":"vertex","label":"moniker","scheme":"rust-analyzer","identifier":"test::inner_func","unique":"scheme","kind":"export"}
{"id":53,"type":"vertex","label":"moniker","scheme":"rust-analyzer","identifier":"test::inner_func","unique":"scheme","kind":"export"}
The following error message seems relevant.
026-04-19T13:20:22.033153037+09:00 ERROR Encountered enclosing definition with no name def=Module(Module { id: ModuleIdLt { [salsa id]: Id(13a4f) } })
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the rust-analyzer lsif . entry point and reproduce the nested-function example, checking the emitted moniker vertices. Trace how enclosing definitions are named, including the reported no-name Module error; done means nested and top-level functions receive distinct scheme-unique identifiers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100