-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-namespaced-featuresArea: namespaced-featuresArea: namespaced-featuresC-bugCategory: bugCategory: bug
Description
With namespaced-features, if a feature name overlaps with an optional dependency, Cargo seems to allow an implicit feature by that name, but that doesn't seem right.
Problem
Given this:
cargo-features = ["namespaced-features"]
[package]
name = "foo"
version = "0.1.0"
namespaced-features = true
[dependencies]
bitflags = {version="*", optional=true}
[features]
foo = ["bitflags"]
Normally if you have a feature on the right-hand-side of a feature definition, it must be a real feature. However, in this case Cargo lets it slide, which it normally doesn't.
cargo build --features bitflags
<-- doesn't build bitflags
I would expect, at least, following the rules, you would need to specify:
bitflags = []
But on top of that, I think creating features names that overlap with optional dependencies is probably not the best behavior, and likely to be confusing.
Notes
cargo 1.44.0-nightly (7019b3ed3 2020-03-17)
cc @djc
Metadata
Metadata
Assignees
Labels
A-namespaced-featuresArea: namespaced-featuresArea: namespaced-featuresC-bugCategory: bugCategory: bug