-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
A-optional-dependenciesArea: dependencies with optional=trueArea: dependencies with optional=trueC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-build-planNightly: --build-plan featureNightly: --build-plan feature
Description
#!/usr/bin/env bash
set -e
cd /tmp
[ -d cargo-optional-deps ] && rm -rf cargo-optional-deps
cargo new cargo-optional-deps
cd cargo-optional-deps
cargo build
cat >> Cargo.toml <<EOF
optional_dep_does_not_exist = { version = "1.0", optional = true }
EOF
cargo build
Fails with
error: no matching package named
optional_dep_does_not_exist
found (required bycargo-optional-deps
)
I did not expect this because the dependency is not required as per http://doc.crates.io/manifest.html#the-features-section:
optional dependencies, which enhance a package, but are not required; and
I'm running into this behavior while integrating Cargo into a private build system that wants control over dependencies. As such, I need to elide optional dependencies by default in this system's dependency list.
I'm opening this issue to get some input on:
- Would ignoring missing optional dependencies for inactive features be a problem for Cargo?
- I tried to look through existing issues - has something like this been discussed before?
- An idea about resourcing/priority of the feature and how it fits into the roadmap for Cargo's integration with existing systems.
adamncasey, singpolyma, jonhoo, wickerwaka, ChenLiu-1996 and 9 more
Metadata
Metadata
Assignees
Labels
A-optional-dependenciesArea: dependencies with optional=trueArea: dependencies with optional=trueC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-build-planNightly: --build-plan featureNightly: --build-plan feature