Skip to content
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

Running a test in VS Code does not respect rust-analyzer.cargo.noDefaultFeatures setting #13008

Open
jameshiew opened this issue Aug 12, 2022 · 0 comments
Labels
A-ide general IDE features C-bug Category: bug

Comments

@jameshiew
Copy link

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

rust-analyzer version: 0.3.1162-standalone (634cfe3 2022-08-07)

rustc version: (eg. output of rustc -V)

rustc 1.63.0 (4b91a6ea7 2022-08-08)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)

Visual Studio Code version details

Version: 1.70.1
Commit: 6d9b74a70ca9c7733b29f0456fd8195364076dda
Date: 2022-08-10T06:09:06.916Z (2 days ago)
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Darwin x64 21.6.0


Running an individual test by clicking Run Test does not respect the rust-analyzer.cargo.noDefaultFeatures setting.

1

In this minimal reproducible example, in .vscode/settings.json, default features have been turned off and the "blue" feature has been enabled. When running the test, the command executed is:

cargo test \
    --package mre-cargo-test-default-features \
    --lib \
    --features blue \
        -- \
            tests::fails_with_default_features \
            --exact \
            --nocapture 

i.e. it is respecting the "rust-analyzer.cargo.features": ["blue"], but not "rust-analyzer.cargo.noDefaultFeatures": true, and the test fails. Interestingly the code guarded by #[cfg(feature = "red")] is greyed out before clicking Run Test.

2

@flodiebold flodiebold added C-bug Category: bug A-ide general IDE features labels Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ide general IDE features C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants