Description
Since a few version, the VSCode extension produce some strange output and seems to not pass all-features
when it treats the tests.
The change was made between the 0.4.2366
and the 0.4.2367
VSCode extension version.
The setting "rust-analyzer.cargo.features": "all"
is well defined into the settings.json
rust-analyzer version: version: 0.4.2428-standalone (a09a550 2025-04-18)
rustc version: rustc 1.88.0-nightly (2da29dbe8 2025-04-14)
editor or extension: VSCode version 0.4.2428 (bug still present)
relevant settings: none
code snippet to reproduce:
const fn add(a: i32, b: i32) -> i32 {
a + b
}
#[cfg(all(test, feature = "mock"))]
mod tests {
use super::*;
#[test]
fn test_name() {
assert_eq!(add(2, 3), 5);
assert_ne!(add(2, 3), 6);
}
}
For the 0.4.2366
, all is OK
But for the 0.4.2367
or any newer version, there is a problem saying that code is inactive due to #[cfg] directives: feature = "mock" is disabled
Please note that the only thing that I changed between these 2 screenshots is the version of the extension.
Activity
[-]setting `"rust-analyzer.cargo.features": "all"` not anymore respected on tests[/-][+]setting `"rust-analyzer.cargo.features": "all"` not anymore respected on some tests with `feature`[/+]benlcb commentedon May 20, 2025
For me setting setting "rust-analyzer.cargo.features": "all" does not work in VS Code in all cases. I have to set the explicit feature names.
lolo32 commentedon May 21, 2025
Even if I specify the feature, it's not working any more in this exemple