In a workspace with multiple packages, one package a
has a feature myfeature
that I want rust-analyzer to enable. I tried setting "rust-analyzer.cargo.features": ["a/myfeature"]
in .vscode/settings.json
, however RA then fails to check another package b
that doesn't depend on a
with the following error message:
cargo check failed to start: Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(25856))): error: the package 'b' does not contain this feature: a/myfeature
How to fix this?
To sum up, the workspace looks like this:
workspace/
Cargo.toml # workspace = { resolver = "2", members = ["a", "b"] }
.vscode/settings.json # { "rust-analyzer.cargo.features": ["a/myfeature"] }
a/
Cargo.toml # feature.myfeature = []
src/main.rs
b/ # does not depend on package `a`
Cargo.toml
src/main.rs # RA errors here: "cargo check failed to start ..."