Building rustc (usually) involves building LLVM. One of LLVM’s compile-time configuration is whether to enable assertions. Currently, in rust-lang’s official builds, LLVM assertions are enabled in the Nightly channel, and disabled on Beta and Stable.
I imagine that these assertions help catch some rustc bugs, but they also have a compiler performance cost. In one particular benchmark, they added 16% to Servo’s compilation time in debug mode and 53% in release mode.
“Rust should have a pleasant edit-compile-debug cycle” is one of the top-level items of the 2017 roadmap. +16% compile time is not insignificant. Arguably everyone should eventually switch to the stable compiler where this is not an issue, but we’re not quite there yet. Dropbox, one of the highest-profile users of Rust in production, say that they’re using Nightly and that compile time are significant issue for them.
At the Servo team’s request, the Rust team added “alternate” builds of rustc that have LLVM assertions disabled. These are made available for every PR that lands in the
master git branch, but they’re not in the Nightly channel. There is currently no easy way to use them with rustup. One needs to forge a URL from a commit hash and a host triple, then download and extract a tarball. This is relatively straightforward to do in Servo’s bootstrapping scripts, but the only reason we built those at all is that rustup did not exist at the time.
I’ve filed an issue on rustup to add support for these toolchains. In that discussion, @brson said:
having a secret unofficial nightly channel that those in the know use to get a "fast" nightly is not desirable to me. If nighties should be fast we should make them fast.
I take it this suggests disabling LLVM assertions in the Nightly channel (and stop making new “alternate” builds which would be no different from the default ones). From the point of view of Rust users this is the best possible outcome. Nightly users just get a nice compile time boost “for free”.
The obvious downside is that when a bug would trigger an assertion that is disabled, weird things may happen silently (I assume) and the bug would be harder to find. But how valuable is this in practice? Is it important that many users, as opposed to only Rust’s own CI, run these assertions?