Cargo can use a local registry replacement

Minimum Rust version: 1.12

Cargo finds its packages in a "source". The default source is However, you can choose a different source in your .cargo/config:

replace-with = 'my-awesome-registry'

registry = ''

This configuration means that instead of using, Cargo will query the my-awesome-registry source instead (configured to a different index here). This alternate source must be the exact same as the index. Cargo assumes that replacement sources are exact 1:1 mirrors in this respect, and the following support is designed around that assumption.

When generating a lock file for crate using a replacement registry, the original registry will be encoded into the lock file. For example in the configuration above, all lock files will still mention as the registry that packages originated from. This semantically represents how is the source of truth for all crates, and this is upheld because all replacements have a 1:1 correspondance.

Overall, this means that no matter what replacement source you're working with, you can ship your lock file to anyone else and you'll all still have verifiably reproducible builds!

This has enabled tools like cargo-vendor and cargo-local-registry, which are often useful for "offline builds." They prepare the list of all Rust dependencies ahead of time, which lets you ship them to a build machine with ease.