rust-lang / rust-lang/rust-analyzer

Generate lint and feature information on server start up instead of embedding them

Open
#11,928 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide E-unknown S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

We currently generate lints, clippy lints and unstable features at compile time every now and then and embed that into our executable. This list gets outdated over time until someone updates it again and it also relient on the compiler version of the person running the tests. We should remove this and query these lists when the server starts.

For rust lints we already use rustc itself to fetch the lints.

For the feature list we clone the rust repo, there doesn't currently seem to be any way to fetch features through rustup.

For rustdoc lints we already use rustdoc itself to fetch the lints.

For clippy lints we download the lints.json file from the rust-lang github page, I don't think there is a way for us to fetch the info we want from a user installation.

The test that generates the things is here:
https://github.com/rust-analyzer/rust-analyzer/blob/3632d5946f1cac47b7cba646a83b64eb9da0f878/crates/ide_db/src/tests/sourcegen_lints.rs

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 crates/ide_db/src/tests/sourcegen_lints.rs to understand how the lint and feature lists are currently generated and embedded. Trace the existing rustc and rustdoc queries, the Rust repository feature lookup, and the clippy lints.json download. Done means these lists are obtained when the server starts rather than generated at compile time, with the relevant tests updated and passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.