Skip to content

Resolver 2.0 unifying features when doing cargo build #10423

@huguesBouvier

Description

@huguesBouvier

Problem

I have a crate a that depends on crate b.
crate b has a feature flag test.

crate a has the following in Cargo.toml:

[package]
name = "cratea"
version = "0.1.0"
edition = "2021"

[dependencies]
crateb = { path = "../crateb "  }
[dev-dependencies]
crateb = { path = "../crateb ", features = ["tests"]  }

When I do cargo build with 2021 edition, I expect crateb to be build without the feature tests but it looks like it is still unifying.

Is there a possible workaround?

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.57.0 (b2e52d7ca 2021-10-21)
release: 1.57.0
commit-hash: b2e52d7cab0a286ee9fcc0c17510b1e72fcb53eb
commit-date: 2021-10-21
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.49+curl-7.79.1 vendored ssl:OpenSSL/1.1.1l)
os: Ubuntu 18.04 (bionic) [64-bit]

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

    Issue actions