Skip to content

rust-analyzer lsif generates non-unique monikers for nested functions #22089

@sanxiyn

Description

@sanxiyn

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) } })

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lsif/scipLSIF/SCIP conformance and features

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions