-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
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
:
[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"
[dependencies]
time = "0.1.12"
regex = "0.1.41"
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:
- Prefer using the latest major release?
- Look at the documentation on
crates.io
, and make a choice there? - Use an external tool to add dependencies to the project?
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
- Consider providing some guidance for users on how dependency versioning should be done.
- In particular, note if there are any consequences for downstream users if you plan to build a rust library?
- Document and describe the use of
cargo add
?
Notes
No response