1. 19

  2. 4

    There is just one compiler for Rust […] This avoids most of the fragmentation we see in C compilers and makes it much easier for the compiler and the analysis tool to give the same meaning to a single piece of code.

    I’m not sure whether this is a good thing or not.

    Having two implementations might be useful for differential testing. IIRC, this is how John Regehr found multiple bugs in LLVM and GCC.

    1. 3

      I’m not sure whether this is a good thing or not.

      Let’s say it like this: It’s not as bad as many people make it to be. For the reason you outline, 2 compilers have their advantage. But there’s a pragmatic problem: is that a good enough reason now to build a second compiler?

      Most people I spoke to, even in critical industries, see the low fragmentation as a good thing, currently and would love if it stayed on that side.

      1. 2

        Competition can be beneficial though. Look at gcc – it’s improved enormously in the last ~10 years, and at a much more rapid pace than had been happening previously. I think it’d be hard to argue that that wasn’t largely due to the sudden appearance of a serious competitor (clang). And between those two, while it does occasionally manifest in non-negligible ways, fragmentation is a relatively tiny issue since both tend to stick to mutually compatible language extensions and command-line flags (though the languages they compile are standardized to a much greater degree than Rust is – which is of course a very closely related issue).

        1. 1

          I’m no questioning any of that. I’m just not sure if it’s in any way realistic now, not that it is the best way to improve current quality. Building a compiler uses a substantial amount of resources. The current Rust team is ~250 people and runs quite a bit of infrastructure for quality control. A competitive compiler would need to muster at least a number of full time people to be built.

          The language specification is a good example of that problem: there’s a desire to create one - but this will need industry funding. Not necessarily in direct money, but definitely in manpower. I see good chances on something like that happening, especially given that it would make the work of verification tool builders much easier.

      2. 2

        there are c implementations of rust to bootstrap the compiler at least, though they have a hard time keeping up with the pace of rustc

        1. 3

          Yep, mrustc. Looks like its continuing to do okay, actually, it says it compiles rustc 1.29 fine. It doesn’t do borrow checking though, just assumes that the input is valid; its goal is really to be able to bootstrap the compiler.