Is rust compiler itself written in rust?

If so, why do we need Night, Beta and Stable versions?
Does not this refute the revolutionary nature of the Rust? The presence of a single Stable version would be the best prove.


Excuse me, if I have misplaced in categories

The Rust compiler is written in Rust, but I'm not sure what that has to do with the existence of beta or nightly, or why their existence would refute anything.

Nightly exists so people can try new features and changes as they are being developed. Beta exists to catch issues with new features and changes before they are added to stable. If they didn't exist, stable would end up with worse features that had more bugs.

6 Likes

Bugs?!
I thought they in rust should always show up during compiling, not in runtime like other languages. And compiled source is always clean.

Any programming language will allow bugs. There is no way that the compiler can know what you wanted your program to do, if it doesn't do what you wanted it to do, ergo the compiler must allow buggy code. Rust can prevent many kinds of bugs, more than most languages, but there is still always a likelihood of bugs in any complex software.

4 Likes

Rust tries to catch many kinds of bugs at compile time, more than dynamically-typed languages, but it's impossible to catch all bugs at compile time (literally, there's a logic proof for this).

Rustc stable/beta/nightly releases aren't only about testing bugs in the compiler, but also trying out new features before they're finalized.

4 Likes

No language can make that claim. Rust certainly doesn't. Rust programs absolutely can contain errors - errors of logic, errors of implementation, or errors of intent are all roughly as common in Rust as in any other language.

Rust, by design, makes certain categories of error easier to detect, and harder to ignore. The ownership model allows the compiler to detect use-after-free issues and conflicting writes, for example, and library designs built on top of that also allow the compiler to detect a large class of concurrent access errors, as well.

Rust cannot help you if you accidentally write return foo - 5 when you meant return foo + 5, though. That category, where the mistake has sound semantics and simply isn't what you intended, can never be fully detected. Even in systems with formal verification, if the specification has a mistake in it, then the resulting program will be buggy in ways that conform to the erroneous specification, and Rust doesn't go that far.

4 Likes

If you're in the mood for some (a lot of) reading, check out Some mistakes Rust doesn't catch.

2 Likes

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.