A big benefit is that all PRs to these components get tested out of the rustc build cycle, and that when one updates the component in the rustc repo, all of these get tested at once. When that happens, there often is a bit of churn because rustc tests things that these components do not, but if these components have good and comprehensive CI, this can reduce significantly the bors queue in rustc itself.
I totally agree with that. I always imagined that the idea would be to basically merge this “libsyntax2-based compiler” with rustc at some point so that there is only one.
I would prefer if most bits and pieces in rustc would live in their own separate crates in the nursery, and rustc becomes a super-project in which the only changes going on are actually just about continuously updating these crates.
We can have two crates doing the same job that can be kind of swapped out. This is currently not true for polonious and chalk, but maybe at some point when we remove the old borrowck, someone could re-implement it into a crate that could be swapped out with polonius just producing different results. So I don’t think that having two libsyntaxes, one for IDEs and one for rustc, is in itself a huge deal. Sure if we only need one that would be better, but if we really do need two, maybe it would be worth to consider integrating libsyntax2 in rustc in such a way that it could also be swapped out, so that when updating other components, we can make sure that libsyntax2 is not broken (or properly updated if it is).
It’s a lot of work to find the right interfaces
These interfaces already exist in rustc in some form, the whole compiler is split up into crates. If making cross-cutting changes becomes more of a pain, which it will, these interfaces might evolve to become more decoupled and make cross-cutting changes easier, or less necessary. That might not be a bad thing. In any case, this will take a lot of time, so I think the question here at this point is more like “Do we ever want to get there?”. How exactly to get there can we discussed later. [0]
- I feel (but I have no proof) that with sufficiently smart use of incremental and the build-system, modifying an end-module should be basically free (
--keep-stage 0 almost gets us there, but more love is needed). For example, as of today, working on rustc_codegen_llvm can be done with no unneeded recompilations.
I find this is really hard to discover and wish ./x.py would do the right thing by default for those working on the compiler who use it the most. Maybe we could mark some of the crates as “–keep-stage 0” so that if you only make changes to it, ./x.py test src/rustc_codegen_llvm automatically does that for you. That is, maybe the better default for ./x.py should be “build and basic test” as fast as possible, and if you want a full stage 2 test, then you should opt into it.
I never faced the “rustc initial build” barrier, because I always have a fully-ready rustc somewhere on my PC,
When working on a laptop, each rustc build with incremental compilation takes dozen of Gbs. I wish there was a way to work on pieces of rustc without having to build it all.
Similarly we need to ensure that all of our bots are running on all these crates, and that we have a kind of consistent reviewing strategy
- right now we are very focused on rust-lang/rust
That heavily depends on the crate: check out libc, stdsimd, packed_simd, etc.