-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
Problem
When adding cargo add with an explicit minimal version, cargo add will show features from the specific version, while actually adding the latest semver-compatible version. This seems misleading and/or confusing.
Steps
cargo add [email protected]
Actual result:
djc-2021 main test-rs $ cargo add [email protected]
Updating crates.io index
Adding chrono v0.4 to dependencies.
Features:
- rustc-serialize
- serde
Expected result:
Updating crates.io index
Adding chrono v0.4.22 to dependencies.
Features:
+ clock
+ iana-time-zone
+ js-sys
+ oldtime
+ std
+ time
+ wasm-bindgen
+ wasmbind
+ winapi
- __doctest
- __internal_bench
- alloc
- criterion
- libc
- pure-rust-locales
- rkyv
- rustc-serialize
- serde
- unstable-locales
This is the output from cargo add [email protected], which is the version that add [email protected] actually pulls in at this time.
Possible Solution(s)
Bump the version to the latest semver-compatible one before extracting features, instead of after.
Version
cargo 1.65.0-nightly (4ed54cecc 2022-08-27)
release: 1.65.0-nightly
commit-hash: 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5
commit-date: 2022-08-27
host: aarch64-apple-darwin
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.79.1 (sys:0.4.55+curl-7.83.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 12.5.1 [64-bit]