Skip to content

rust-analyzer.cargo.features can break running of tests in workspaces #11836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jplatte opened this issue Mar 28, 2022 · 1 comment · Fixed by #14910
Closed

rust-analyzer.cargo.features can break running of tests in workspaces #11836

jplatte opened this issue Mar 28, 2022 · 1 comment · Fixed by #14910
Labels
A-config configuration C-enhancement Category: enhancement

Comments

@jplatte
Copy link
Contributor

jplatte commented Mar 28, 2022

In a workspace with multiple crates, where some have a feature of a certain name but others don't, you may want to set "rust-analyzer.cargo.features": ["feature-name"] to have feature-gated code benefit from rust-analyzer's functionality.

However, with that setting, when trying to use RA's "Run test" helper on a test inside a crate without a feature named feature-name, RA still passes --feature feature-name to Cargo, leading to an error because that feature doesn't exist.

rust-analyzer version: bc08b8e 2022-03-28 stable
rustc version: rustc 1.61.0-nightly (c84f39e6c 2022-03-20)

@smmalis37
Copy link

Bump, this has been a huge pain point for me, would love to see this fixed.

@Veykril Veykril added A-config configuration C-enhancement Category: enhancement labels Feb 9, 2023
bors added a commit that referenced this issue May 26, 2023
Filter out unused cargo features from config

Closes #11836
@bors bors closed this as completed in 7c81fff May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-config configuration C-enhancement Category: enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants