Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCargo time machine #5221
Comments
alexcrichton
added
the
C-feature-request
label
Mar 21, 2018
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
|
@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.
This comment has been minimized.
|
Time aside, I'd like to have a way to do this via git hash of the crates.io index.That'd be great for reproducing bug reports. Also see #6161 |
est31 commentedMar 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
crates.iorequired 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 crates.io 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 invokecargo 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 :).