Skip to content

Testing workspace package with features expects the root package to have those features #4106

Closed
@torkleyy

Description

@torkleyy

Consider this project structure:

foo
├── bar
│   ├── Cargo.toml
│   └── src
│       └── lib.rs
├── Cargo.toml
└── src
    └── lib.rs

If I add a feature to foo/bar/Cargo.toml called whatever and I run

cargo test -p bar --features whatever

I get

error: Package `foo v0.1.0 (file://[...]/foo)` does not have these features: `whatever`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-featuresArea: features — conditional compilationA-workspacesArea: workspacesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions