Back to Architecture Explorer

rust-lang / rust

Empowering everyone to build reliable and efficient software.

98.0k
Rust
Architecture: compiler
main
rust
compiler
rustc_parse
rustc_middle
rustc_codegen_llvm
library
core
alloc
std
src
bootstrap
tools
doc
tests
ui
codegen
Cargo.toml
Structural Architecture

The Rust repository separates the compiler from the standard library at the top level, which mirrors how the project is actually built: the compiler is bootstrapped in stages, and each stage compiles the library. Tests are split by kind rather than by module, because the compiler needs test suites that assert on its own diagnostics.

  • Compiler and standard library kept as separate top-level trees.
  • Tests grouped by kind rather than by the module under test.
  • A bootstrap directory dedicated to the multi-stage build process.

Notable Directories

/compiler

The rustc compiler, split into crates by phase such as parsing, type checking, and code generation.

/library

The standard library: core, alloc, and std, layered by what each can depend on.

/tests

Suites organised by kind, including UI tests that assert on exact compiler output.

/src/bootstrap

The staged build system that compiles the compiler with itself.

Build Your Own Ecosystem

Learn from rust's structure and craft your own software scaffolding.