Hi Cargo team,
When working with crates stored in $CARGO_HOME/registry/src/
,
I noticed that the source path is typically under a directory named like index.crates.io-xxxxxxxx
.
However, on my machine, there are multiple such directories, for example:
index.crates.io-1949cf8c6b5b557f
index.crates.io-6f17d22bba15001f
I would like to understand:
- How exactly is the
xxxxxxxx
part (the hash suffix) generated? - Why might there be multiple
index.crates.io-*
directories on the same machine? - When Cargo needs to resolve a crate during build, how does it determine which
index.crates.io-*
folder to use?
From reading the source code, it seems related to CanonicalUrl
and some hashing mechanism,
but I'm not entirely sure about the complete process.
Thank you very much for your help!