Skip to content

setting "rust-analyzer.cargo.features": "all" not anymore respected on some tests with feature #19630

Open
@lolo32

Description

@lolo32

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

Image

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

Image

Please note that the only thing that I changed between these 2 screenshots is the version of the extension.

Activity

changed the title [-]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`[/+] on Apr 19, 2025
benlcb

benlcb commented on May 20, 2025

@benlcb

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

lolo32 commented on May 21, 2025

@lolo32
Author

Even if I specify the feature, it's not working any more in this exemple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lolo32@benlcb

        Issue actions

          setting `"rust-analyzer.cargo.features": "all"` not anymore respected on some tests with `feature` · Issue #19630 · rust-lang/rust-analyzer