Is there a way to see the latest version of a crate using cargo?
I mean not "just" the latest "matching" version but really the latest.
When I have zeroize = { version = "0.9", optional = true } in Cargo.toml then cargo downloads and builds the latest 0.9.x version.
Part of cargo's output is Checking zeroize v0.9.3
What I would like to see is Checking zeroize v0.9.3 (latest is 1.1.0)
Is there an option to enable this?
The Rust ecosystem is evolving fast and showing the latest version number would enable crate maintainers to notice a major change of dependent crates.
$ cargo search zeroize
zeroize = "1.1.0" # Securely clear secrets from memory with a simple trait built on stable Rust primitives which guar…
zeroize_alloc = "0.1.2" # A zeroizing allocator wrapper.
zeroize_derive = "1.0.0" # Custom derive support for zeroize
clear_on_drop = "0.2.3" # Helpers for clearing sensitive data on the stack and heap
abscissa = "0.5.1" # Application microframework with support for command-line option parsing, configuration, error han…
abscissa_core = "0.5.2" # Application microframework with support for command-line option parsing, configuration, error han…
cellar-core = "0.2.1" # A password tool for user to derive a large amount of application passwords deterministically base…
curve25519-dalek = "2.0.0" # A pure-Rust implementation of group operations on ristretto255 and Curve25519
enocoro128v2 = "0.1.2" # Safe, no-std Enocoro-128 (Version 2) stream cipher implementation. Verified using Hitachi's offic…
septid = "0.1.0" # Pure Rust implementation of the spiped protocol
You may also be interested in cargo-outdated for detecting when your dependencies have updates.
$ cd path/to/some/repo && cargo outdated
Name Project Compat Latest Kind Platform
---- ------- ------ ------ ---- --------
clap 2.20.0 2.20.5 2.26.0 Normal ---
clap->bitflags 0.7.0 --- 0.9.1 Normal ---
clap->libc 0.2.18 0.2.29 Removed Normal ---
clap->term_size 0.2.1 0.2.3 0.3.0 Normal ---
clap->vec_map 0.6.0 --- 0.8.0 Normal ---
num_cpus 1.6.0 --- 1.6.2 Development ---
num_cpus->libc 0.2.18 0.2.29 0.2.29 Normal ---
pkg-config 0.3.8 0.3.9 0.3.9 Build ---
term 0.4.5 --- 0.4.6 Normal ---
term_size->libc 0.2.18 0.2.29 0.2.29 Normal cfg(not(target_os = "windows"))
Besides the error I think that cargo outdated does too much. cargo already already has all the information from crates.io. So showing the latest version should be "easy" (for some definition of easy").
I think it is important to be notified if e.g. a crate got updated from a 0.x.y version to 1.u.v
If you want to check a single dependency you could run cargo search to find the latest version, then compare that with Cargo.toml (or grep Cargo.lock).
Otherwise there's also cargo update built into cargo which will update all dependencies in the local package to the most recent semver-compatible version.
I think cargo outdated is actually doing what you're asking for. It'll look at the current version of each of your dependencies and show you what the highest semver-compatible version is and the latest version. I normally use the -R flag to only show me the top-level dependencies (i.e. the ones I can control) which are outdated.
You may also want to check out dependabot if you want the process to be automated.