rust-lang / rust-lang/rust-analyzer

Autocompletion doesn't work for rlibs

Open
#13,716 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-Architecture C-feature E-hard S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

I have attached a minimal example that reproduces the issue. It consists of two projects, where the "binarylib3" one uses the rlib directly. It builds successfully and can call functions defined in the rlib without any problems except that autocompletion doesn't work. The provided example project also serves as an attempt to wrap the library into something that plays nicely with Cargo that's easy to add as a dependency to other projects without the consumer of the library having to add anything to their build.rs file. The project "binarylib3consumer" also builds successfully and can call functions defined in the rlib, reexported by "binarylib3", with no problems other than autocompletion not working.

I am well aware of the challenges that come with such usage of rlib libraries, but keep in mind that they pose no issue to some companies and individuals that find standardizing on a compiler version within the organization to be acceptable.

rustc --version
rustc 1.66.0-nightly (9062b780b 2022-09-21)

rust-analyzer --version
rust-analyzer f1d7f98ed 2021-09-21 dev

example1.tar.gz

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached example1.tar.gz and compare the binarylib3 and binarylib3consumer projects while reproducing the missing autocompletion with the reported rustc and rust-analyzer versions. Trace how rust-analyzer handles the rlib dependency; done means autocompletion works for functions available directly and through re-exports.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.