|0.1.5||Sep 2, 2019|
|0.1.4||Aug 31, 2019|
#84 in Cargo plugins
24 downloads per month
Trying to use an old compiler, and all the dependencies are broken? Here's a workaround.
This is a proof of concept of an alternative crates registry that contains crates compatible with old Rust versions.
You can set crates-io registry state per project to contain only crates that are compatible with a selected Rust version.
- Rust 1.13 or later (this is so old, that even Debian has it),
Tested on macOS and Linux.
The current implementation just rewinds the crates-io registry to a previous commit from a date of release of a specific Rust version, and configures Cargo to use the truncated registry. This means that the registry won't contain any newer crates, even if they'd be compatible.
A future implementation will use a specially-filtered custom registry, allowing use of all crate versions as long as they're compatible. You can preview it here: https://github.com/kornelski/crates.io-index
cargo install -f lts
cd to your project's directory (where
Cargo.toml is), and run:
It will configure the current project to use registry compatible with the current compiler. On the first run, it may take a few minutes to download the full registry.
You can specify an old Rust version as a compatibility target
cargo lts 1.26.0 or a specific date
cargo lts 2018-01-01.
And then run:
Cargo.lock from the stale registry. To go back to the future, delete
[source.crates-io] replace-with = … from
You can set
CARGO_MANIFEST_DIR environmental variable to modify other than the current directory.
cargo lts assumes the index is in
$CARGO_HOME/registry/index/github.com-1ecc6299db9ec823/.git. You can set
CARGO_REGISTRY_GIT_DIR to reference another checkout of the index.
cargo lts prefetch fetches the registry without altering the local project. Useful to cache registry state in Docker images.
Alternatively, you can use it to set a custom registry URL:
cargo lts https://github.com/kornelski/crates.io-index cargo update
In addition to configuring the URL replacement, it will also symlink the replacement registry's cache dir to crates-io cache dir, to avoid duplicating downloads (obviously, use it only for registries that are subsets of crates-io to avoid collisions).