rust-lang / rust-lang/rust-analyzer
Does features in [dependencies] in the Cargo.toml will be enabled by RA?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
The following toml settings is part of a rust project. Note that it specify the features in the vm-memory dependency.
[package]
name = "vmm"
version = "0.1.0"
authors = ["Amazon Firecracker team <firecracker-devel@amazon.com>"]
edition = "2021"
license = "Apache-2.0"
[dependencies]
vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-bitmap"] }
I have set the rust-analyzer.cargo.features to default value (i.e. []) and DO NOT enable allFeatures.
When I edit the .rs source code files in the project directory, everything works fine, and the RA seems to recognize the features in Cargo.toml, i.e., it enables the "backend-mmap" and "backend-bitmap".
But when I jump into the source code files in the dependency crate (e.g., files in ~/.cargo/registry/src/......), which is outside the project directory, the RA DO NOT enable "backend-mmap" and "backend-bitmap". RA seems use the rust-analyzer.cargo.features for those files outside the project directory, instead of using that in [dependencies] section in Cargo.toml.
My questions are:
- Why features in [dependencies] not enable when I jump into source code in the dependency crate? Is there something I missed?
- Because I do not want to enable all features in the dependencies (which means I do not want to enable
rust-analyzer.cargo.allFeatures), how can RA only enables the features in the [dependencies] section inCargo.tomlwhen I jump into the source code files in that crate?
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
Reproduce the behavior using the provided Cargo.toml dependency features and the rust-analyzer.cargo.features and rust-analyzer.cargo.allFeatures settings. Compare feature resolution for project files with files under ~/.cargo/registry/src, then determine whether the observed dependency behavior is expected. Done means documenting the resolution or identifying a focused change needed to make dependency features behave as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100