Incremental compilation recompiling too much code?

I'm ve started hacking on a bigger multicrate Rust project (GitHub - prisma/prisma-engines: 🚂 Engine components of Prisma 2+). The whole project compiles about 6 minutes for me, from scratch. That's expected and I don't complain.

I added a new file with a top-level, public, unused enum to one of the subcrates without making any other changes.

If I recompile that crate alone in its subdirectory, it takes 0.4 second. As expected.

If I recompile the whole project by cargo build in its root directory, it takes whopping 30 seconds and shows recompiling some dependant crates. But why, if I added stuff that's unused? Is it expected behavior or is it a limitation of current incremental algorithms? Is maybe something broken?

The same happens if I change the number of variants in that unused enum.

I'm using recent 1.60 beta, so incremental compilation should be fixed, is it correct?

If any dependency of a crate changes, rustc requires that all dependent crates are recompiled. This should be faster than from scratch recompilation when using incremental compilation, but it can still take a while. Dependent crates may contain parts of the dependency. For example if it uses any generic of #[inline] function or one returning impl Trait.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.