-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Problem
Cargo accepts the following dependency specification:
[dependencies]
ordered-float = ">=3, <=5.*"
However, it is not documented what this actually means. The documentation describes “comparison requirements” and “wildcard requirements” separately, and implies that a wildcard requirement is equivalent to a certain combination of >=
and <
requirements, not specifying any meaning of a wildcard occurring inside a comparison requirement. Yet, testing seems to indicate that in this case, it acts as an upper bound only, i.e. the above is equivalent to >=3, <6
(possibly modulo pre-releases). This behavior makes intuitive sense, but the documentation is written as if <=5.*
should be a syntax error.
Steps
No response
Possible Solution(s)
If this behavior is intended, it would be useful to document it, because it would allow multi-major ranges to be expressed without unintuitively needing to mention a version that is intended to be excluded, and, if it excludes pre-releases where <6
does not (I do not know if this is so), then it is actually a superior option. If this behavior is not intended, it should be deprecated/removed.
Notes
@rustbot label A-documenting-cargo-itself A-crate-dependencies
Version
cargo 1.88.0 (873a06493 2025-05-10)
release: 1.88.0
commit-hash: 873a0649350c486caf67be772828a4f36bb4734c
commit-date: 2025-05-10
host: aarch64-apple-darwin
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.7.1 (sys:0.4.80+curl-8.12.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.4.1 11 Feb 2025
os: Mac OS 15.7.1 [64-bit]