CARGO_INCREMENTAL doesn't work

Hello.
CARGO_INCREMENTAL=1 doesn't give any effect anymore. I just changed content of the string variable in code, one string, nothing else, and compilation still takes same time as when I change a lot of lines with code.
rustc 1.20.0-beta.2 (54279dfac 2017-08-13)

1 Like

Without more details, this is very hard to judge...

How big is the program? If it is very simple, the incremental optimisation may provide invisible little speedup.

Also, if this string is used by many other parts of the program, it could be that this string triggers an avalanche of things that must be recompiled.

Finally, did you see an effect before? If so, what is the last (nightly?) version that worked?

Compilation takes 8-10 minutes. When CARGO_INCREMENTAL was introduced in beta, it helped to reduce compilation time to 5 minutes. For cases when just single string var was changed, compilation was 3-4 minutes. But now it's 8-10 minutes with any size of the change. I can't remember when I first noticed it, but I just don't see the difference anymore. And no, that line is not being used by the whole app - just one function.

1 Like

Setting CARGO_INCREMENTAL instructs cargo to pass the flag -Zincremental to rustc.

Starting with Rust 1.19, passing any kind of -Z flag to rustc has been disallowed on stable and beta channels.

I know this is annoying and so far, this change (in conjunction with personal laziness tbh) has kept me from updating Rust.

AFAIK, the only way to keep incremental compilation for now is to switch to the nightly channel.

3 Likes

Thank you for info.
Yes, it’s very frustrating... Not sure what to do. Using nightly for production server doesn’t look like a good idea because of possible breaking changes and regressions. From other side, compilation kills productivity a lot.

Just to clarify your use case, do you need fast builds in production, or only for development use cases? If it's the later, a possible compromise would be to use the nightly channel for development and the stable channel for production.

5 Likes