Skip to main content

Is Rust compiled or interpreted?

Rust is compiled β€” specifically, it is an ahead-of-time compiled systems programming language.

Unlike interpreted languages such as Python or JavaScript, Rust source code is translated directly into native machine code by its compiler, rustc, before execution ever begins. Nothing reads your source line by line at runtime.

What happens when you press build

  1. 1. Parsing into an AST

    rustc reads your source text and builds an Abstract Syntax Tree: a structured representation of every item, expression and type annotation you wrote. Syntax errors are caught here, before anything else runs.

  2. 2. Lowering to an intermediate representation

    The AST is lowered through HIR and then MIR, Rust's mid-level IR. This is where the interesting work happens: type checking, trait resolution, and the borrow checker proving that every reference outlives the data it points at.

  3. 3. LLVM generates machine code

    MIR becomes LLVM IR, and the LLVM backend optimises it into native machine code for a specific platform. Iterator chains collapse into tight loops, generics are monomorphised into concrete functions, and abstractions that looked expensive in the source cost nothing at runtime.

  4. 4. A standalone executable

    The result is a binary that runs on its own. No interpreter, no virtual machine, no runtime to install on the target machine. That is why Rust turns up in operating systems, browsers, embedded devices and command-line tools.

Why this matters to you as you learn

Because compilation happens up front, whole categories of bug are caught before your program ever runs: memory safety violations, data races between threads, and type mismatches. In an interpreted language most of those become runtime crashes discovered by your users. In Rust they are compiler messages discovered by you, in seconds, with a suggested fix attached.

There are experimental tools β€” miri is the well-known one β€” that interpret Rust's intermediate representation to detect undefined behaviour during testing. They are diagnostic instruments, not a development workflow. There is no standard Rust interpreter, and a REPL-style β€œjust run this line” model does not exist the way it does in Python.

So how is Rust running in a browser tab?

This is the honest part, and it is worth understanding because it is exactly the point of the previous section: your browser cannot compile Rust. There is no interpreter we could ship to it, and shipping a full rustc plus LLVM toolchain as a download is not a realistic page weight.

So Rust Online splits the work in two. The instant layer runs in your browser: the same grammar the compiler uses parses your code on every keystroke, so structural mistakes are underlined with zero network latency. The truthful layer runs on a real toolchain: a moment after you stop typing, your program is sent to a genuine rustc build and the output you see is the actual output of the actual binary β€” real diagnostics, real error codes, real stdout.

We never simulate compiler output. If a message appears on the right, rustc produced it. That is deliberate: the fastest way to get good at Rust is to build a working relationship with the real compiler, and you cannot do that against a fake one.

Can a non-coder learn Rust this way?

Rust's reputation for difficulty is mostly a feedback-loop problem, not a concept problem. Traditionally you install a toolchain, create a project, run a build, read an intimidating wall of text, and repeat. Compress that loop to under a second, put a companion next to it that translates the compiler's message into plain English, and the borrow checker stops feeling like an opponent and starts feeling like a very pedantic pair programmer.

Start with the guided examples or open the editor and just start typing.