New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo time machine #5221

est31 opened this Issue Mar 21, 2018 · 3 comments


None yet
4 participants
Copy link

est31 commented Mar 21, 2018

Some time ago I wanted to check how much faster my library has got in various Rust versions. So I cloned the repo and checked out an older git commit and used rustup to get an older rustc and tested it both with the older rustc and the newer one... it downloaded various dependencies and tried to build it (with the older rustc) but then it failed because apparently the crates on required newer Rust versions than the one I was benchmarking my library with. So I figured out a trick: I've told cargo to not use as a registry source but my own private clone, and I made that clone point to a commit from back when the compiler got released. This worked really well!

Now to my feature request. I'd like to have this automated, via a flag in cargo: if you invoke cargo generate-lockfile --registry-time 2017-01-01, cargo would check out a commit from that day from the registry and use that commit for lockfile generation.

I think it is justified to call this feature "time machine" because it emulates the time from back then.

Everyone who has missed the presence of a Cargo.lock can feel this I think :).


This comment has been minimized.

Copy link

Michael-F-Bryan commented Mar 23, 2018

This sounds like it'd be really awesome as some kind of sub-command/cargo wrapper!

So you might run cargo time-machine bench --registry-time 2017-01-01 -p my-crate and it'll run benchmarks using the version of rustc and your crate closest to that date. You could use cargo time-machine install --registry-time 2017-01-01 -p my-crate for installation, and so on.


This comment has been minimized.

Copy link

est31 commented Mar 29, 2018

@Michael-F-Bryan as we've got other commands to influence cargo resolution like #4100 , I think the best place for integration is Cargo itself.


This comment has been minimized.

Copy link

joshtriplett commented Oct 10, 2018

Time aside, I'd like to have a way to do this via git hash of the index.That'd be great for reproducing bug reports.

Also see #6161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment