What does it mean to have no rust in incremental compilation?
I'm an outsider trying to figure out if Rust is right for my projects.
I've read that Rust doesn't have incremental compilation (despite beta features).
-
Is it like everything will be implemented in headers in C ++ (like most Boost )?
-
If the above is true, does this limit Rust to fairly small projects with little dependencies? (If, say, Qt or KDE were just headers, then programs using them would be extremely painful to develop, since you effectively recompiled Qt / KDE every time you want to compile your own code.)
source to share
In C and C ++, the compilation block is usually the source file, and all the header files it transitively includes. An application or library usually consists of several compilation units that are linked to each other. An application or library can be optionally linked with other libraries. This means changing the source file only requires recompiling the source file and then reloading, changing the external library only requires a reload, but changing the header file (whether it is part of the project or external, the compiler cannot tell the difference) requires recompiling all the original files that use it and then reused.
In Rust, a box is a compilation unit. (The box can be an application or a library.) Rust does not use header files ; instead, the equivalent information is stored as metadata in compiled boxes (which is faster to parse and has the same effect as precompiled headers in C / C ++). The box can be additionally linked to other boxes. This means that changing any of the source files for a box requires the entire box to be recompiled, and changing a box requires recompiling all boxes that depend on it (currently, this means recompiling from source, even if the API has not changed).
To answer your questions, no, Rust does not recompile all dependencies every time you recompile your project; quite the opposite.
Incremental compilation in Rust is a reuse of work done in previous drawer builds to speed up compilation times. For example, if you change a module and do not affect other modules, the compiler can reuse the data that was generated when the other modules were last compiled. Lack of incremental compilation is usually only a problem with large or complex boxes (for example, those who use macros heavily).
source to share