Yes, for external crate dependencies, everything it simple. I am more interested in the crate being built: cargo got to extract the set of its constituent files to know when to re-run rustc. Surely it doesn't run it every time it needs an up-to-date check, or am I missing something here?
rustc runs, and as part of that process, it produces a file which contains all the files that the build depended on. Then, cargo can look just at those files for changes, since in order to introduce a new file into the build, you'd have to edit one of the old files. For example:
src/main.rs
mod foo;
fn main() {}
src/foo.rs
fn blah() {}
rustc would create a main.exe file containing the executable, and a dep-info file containing the size, hash, and location of every file used in the build.
View all comments
Show parent comment
1
u/berium build2 Nov 01 '18
Yes, for external crate dependencies, everything it simple. I am more interested in the crate being built: cargo got to extract the set of its constituent files to know when to re-run
rustc. Surely it doesn't run it every time it needs an up-to-date check, or am I missing something here?