-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo guide: guidance around selecting the version of a dependency? #10624
Comments
I also stumbled on a semi-related entry in the FAQ: https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies which I think implicitly recommends versioning of the form |
For how precise to be, there was a users thread on that subject.
In addition to the guide page, we should also consider the reference page. The former can focus more on We've also talked about getting crates.io to be updated to reference |
@kevinushey - I agree with you about your interpretation somewhat. That FAQ answer is saying that you may use If the package is following semantic versioning, the constraint I would like is "MAJOR number must be exactly X, MINOR number and PATCH must be at least Y.Z". But I don't know if I can enforce that in Cargo? The other question I don't know the answer to, but it seems relevant, is this: Suppose my package Sorry I'm not adding answers here - I'm just flagging some ways that I, as a relatively inexperienced Cargo user, also get confused. |
You are looking for the
Yes, Clean builds will generally be faster when things unify. But, developers want the latest changes from there deps and want a way to upgrade. As a compromise, Cargo will try to get the largess version for each dep (even if that means having |
This might deserve it's own issue, but I found my way here wishing that
I love that cargo add can go find the latest version for me, I just don't want it to lock all the way to the patch version. As a workaround I run add then remove the patch version from my Cargo.toml manually. |
People have requested options for controlling the precision but I've generally pushed back
However, to support people who do customize their precision, cargo upgrade preserves the existing precision. |
Problem
In the cargo guide, the page on dependencies (https://doc.rust-lang.org/cargo/guide/dependencies.html) describes how one can add specific versions of a couple dependencies, e.g. by editing
Cargo.toml
:and then links to external documentation regarding SemVer and how other / newer versions of packages could be requested.
However, the documentation doesn't provide any specific guidance around how one should normally choose the versions of their dependencies. Is there any existing convention in the community? For example:
crates.io
, and make a choice there?It might also be worth documenting the use of
cargo add
, once #2179 becomes part of stable.It would also be nice if the crate versions chosen in this documentation matched a more current version (regex is currently 1.5.5, based on https://crates.io/crates/regex).
Proposed Solution
cargo add
?Notes
No response
The text was updated successfully, but these errors were encountered: