Skip to content
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 check" should re-use "cargo build" artifacts #4147

Closed
RalfJung opened this issue Jun 8, 2017 · 2 comments
Closed

"cargo check" should re-use "cargo build" artifacts #4147

RalfJung opened this issue Jun 8, 2017 · 2 comments

Comments

@RalfJung
Copy link
Member

RalfJung commented Jun 8, 2017

Right now, even if you have all your dependencies compiled already via "cargo build", doing "cargo check" re-builds all of them. That seems somewhat redundant, and it is certainly frustrating given that the expectation for check is to be fast -- but because of this, it can actually be much slower than "build". (This is even more true if you stick to nightly, where all your dependencies are re-built daily anyway because your toolchain keeps changing.)

I asked about this on #rust, and from what I understood, fixing this requires two pieces. (But this may be entirely wrong! Please correct me.)

  • Change rustc so that when it does --emit=metadata, it can handle both an rlib and an rmeta for dependencies. (Or maybe that's already the case?)
  • Change cargo to tell rustc re-use an up-to-date rlib if there is no rmeta, rather than building a new rmeta.
@RalfJung
Copy link
Member Author

RalfJung commented Jun 8, 2017

Actually, the first part seems to already be the case. I took the command given by cargo check -v, replaced some of the rmeta by rlib (had to change the hash for some of them), and things still seemed to work.

@alexcrichton
Copy link
Member

I believe this is a dupe of #3501 so closing in favor of that, but thanks for the report!

Unfortunately it's pretty tricky to share the implementation details here today, but it's definitely possible and I hope to implement it one day in Cargo! I believe we've got all the compiler support necessary and we just need changes on the Cargo side of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants