rust-lang / rust-lang/rust-analyzer

[feat] Should support `quickfix` adding missing feature

Open
#15,798 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Problem

Currently, fix missing feature does not support quick fix.

failed to resolve: could not find `X` in `Y` the item is gated behind the `Z` feature
error[E0433]: failed to resolve: could not find `X` in `Y`
...
note: found an item that was configured out
    = note: the item is gated behind the `Z` feature
No quick fixes available
Currently

Need 5 human steps to fix

  1. Click for full compiler diagnostic

  2. Copy feature name Z, remember depedency name Y

  3. Find Cargo.toml

  4. Open Cargo.toml, locate Cargo.toml dependencies field Y

  5. Alter Y = "1.2.3" to Y = { version = "1.2.3", features = ["Z"] }

Feat

Should support quickfix adding missing feature

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 by tracing rust-analyzer's handling of the shown compiler diagnostic and its quick-fix generation; the issue identifies Cargo.toml and the dependency feature syntax as the target configuration. The work is done when a diagnostic identifying dependency Y and feature Z offers a quick fix that adds Z to Y's dependency declaration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
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.