Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> this may or may not be because the compiler itself is written in Rust

Well, due to the nature of self-hosting compilers, it's certainly greatly exacerbated by being written in Rust. :)

To wit, a self-hosting compiler must actually compile itself no less than three times to ensure that the generated artifacts "converge" upon a single point. This is as true for Rust as it is for GCC.



Three times, so:

    1. Old version compiles new version
    2. New version, compiled by old version, compiles new version
    3. New compiled by new-compiled-by-old compiles new version
I hadn't heard of this before and initially didn't see why #3 is special. But I guess the idea is, the output object code is a function of both the input source code and the compiler version. And those two are the same for #2 and #3. So you expect the output of both #2 and #3 to be identical, and if it's not, that's a bug in the compiler. Is that how it works?


Yes, the third compile is effectively a single very large test.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: