You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to run cargo add crate -F feature with crate = "*" or crate = { version="*" } in Cargo.toml, an error is returned.
Steps
Add time = "*" to Cargo.toml
Run the following command:
$ cargo +nightly add time -F serde
Updating crates.io index
Adding time * to dependencies
error: unrecognized feature for crate time: serde
no features available for crate time
Change time = "*" to time = "0.3"
Run the command again:
$ cargo +nightly add time -F serde
Updating crates.io index
Adding time v0.3 to dependencies
Features as of v0.3.0:
+ alloc
+ serde
+ std
- formatting
- itoa
- large-dates
- local-offset
- macros
- parsing
- quickcheck
- quickcheck-dep
- rand
- serde-human-readable
- time-macros
List of features changes when using the last concrete version (0.3.36).
Possible Solution(s)
For version="*", I would expect that it uses the feature list of the used root dependency (as in Cargo.lock) or of the latest version available.
When cargo add looks for available features to display and validate against, it looks to the oldest version compatible with your version requirement, assuming
You set the minimum supported version in your version requirement
The dependency doesn't remove features, making this the lowest common denominator for your version requirement. Granted, this gets fuzzy with multi-major version requirements.
In your case, its picking time = "0.1.0" and only allowing features from that version.
Problem
When trying to run
cargo add crate -F feature
withcrate = "*"
orcrate = { version="*" }
in Cargo.toml, an error is returned.Steps
time = "*"
to Cargo.tomltime = "*"
totime = "0.3"
List of features changes when using the last concrete version (0.3.36).
Possible Solution(s)
For version="*", I would expect that it uses the feature list of the used root dependency (as in Cargo.lock) or of the latest version available.
Notes
No response
Version
cargo 1.83.0-nightly (80d82ca 2024-09-27)
release: 1.83.0-nightly
commit-hash: 80d82ca
commit-date: 2024-09-27
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Fedora 41.0.0 (FortyOne) [64-bit]
The text was updated successfully, but these errors were encountered: