Skip to content

Support the [features] section in virtual manifests #4942

@twistezo

Description

@twistezo

I have project structure:

+---workspace_a
¦   ¦   Cargo.toml
¦   ¦   
¦   +---src
¦           lib.rs
¦   Cargo.lock
¦   Cargo.toml

Main manifest ./Cargo.toml:

[workspace]
members = ["workspace_a"]

[dependencies.workspace_a]
path = "./workspace_a"

[features]
only_a = [
    "workspace_a/only_a"
]

Workspace manifest ./workspace_a/Cargo.toml:

[package]
name = "workspace_a"
version = "0.1.0"
authors = ["author.com"]

[features]
only_a = []

And ./workspace_a/lib.rs:

#[test]
fn test_a() {
    assert_eq!(1, 1);
}

#[cfg(not(feature = "only_a"))]
#[test]
fn test_b() {
    assert_eq!(1, 1);
}

When i'm in root and trying cargo test --all --features only_a virtual manifest doesn't see feature in my workspace.

It's working when i'm in ./workspace_a/ or when main manifest it's not virtual.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-featuresArea: features — conditional compilationC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-propose-closeStatus: A team member has nominated this for closing, pending further input from the team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions