rust-lang /

Rust

Live map
Snapshotmain · 67854e5

How rustc turns source text into checked MIR, optimized machine code, and a linked program.

Click a building or route
Choose a path

Watch raw syntax become stable HIR and acquire inferred types before lower-level execution details appear.

System map8 components · 7 connections
130%
Rust compiler architectureRead the compiler city from upper left to lower right. Source becomes increasingly semantic through parsing, HIR, types, and MIR before the backend emits and links native code.source files, edition,…AST items, expressions…HIR body IDs, definiti…rustc driverHIR loweringParserType checkerMIR builderBorrow checkerLLVM andlinkerMIR optimizer
Connections
BuildingsEntryServiceComputeStorageRuntimeToolingExternal

Terms, in plain English

ASTAbstract Syntax Tree: a tree that closely represents the grammar and written structure of source code.

How to study this repo

  1. 1
    Track one expression

    Pick a small Rust expression and identify how its AST shape is simplified in HIR before type checking.

  2. 2
    Draw one MIR body

    Compile with MIR output enabled, then label its basic blocks, terminators, moves, and drops using rustc_mir_build as a guide.

  3. 3
    Connect safety to codegen

    Trace why borrow checking happens on MIR before optimization, then follow the verified body toward LLVM and the linker.