.cargo/registry/src outdated crates in the file

LinuxMint 22.3 zena. Rust 1.93.0. Some crates no longer maintained. Try to rid of them with

rm -r which works,temporarily but they end up returning in the
.cargo/registry/src. Always looking to free up disk space and just curious as to why older versions,not even listed in crates.io, keep coming back in the .cargo/registry/src list.

i.e. getrandon-0.2.17 vs getrandom-0.3.4
phf-0.10.1 vs phf-0.11.3
rand-0.8.5 vs rand-0.9.2
and some others. Mostly just curious Not really that big of deal.
Thanx.

They're coming back because some of the code you're compiling uses them.

They are definitely in crates.io:

https://crates.io/crates/getrandom/0.2.17
https://crates.io/crates/phf/0.10.1
https://crates.io/crates/rand/0.8.5

Thanks for the reply. In Cargo.toml, even though the 'edition = 2024' and [dependencies] specifically states rand = "0.9.2", there is some other program in my Rust file that will use older versions of crates,like rand 0.8.5, even though 'rand' not listed in [dependencies],at all,in a particular Rust 1.93.0 version program?
Newb,here.

Check Cargo.lock for a full list of all transitive dependencies (that is, dependencies, dependencies of dependencies, and so on) of your program. You can also see how different dependencies are related to each other (as in, what depends on what). (Also, you generally should not need to manually modify Cargo.lock, it's automatically generated for you.)

1 Like

Ok. Thanks for the replies. 'Dependencies of dependencies'. :slightly_smiling_face:

The command cargo tree will list all transitive dependencies in a tree so you can see how they are used. You can also focus on a single package’s dependents, for example,

cargo tree --invert=rand@0.8.5

This will print all the packages in your project that depend on rand version 0.8.5 specifically, and then the packages that depend on those packages, and so on.

1 Like