How rust-lang/rust works
Rust’s repository contains the Rust compiler, standard library, documentation generator, and developer tools. The principal workflow is a developer submitting Rust source to rustc and receiving compiled output; the compiler’s tree also shows distinct parsing, lowering, type-checking, borrow-checking, and code-generation stages. The sampled files establish links within inference and trait solving, but do not expose the compiler’s top-level orchestration, so those broader workflow links are marked unverified. README capabilities such as rustdoc, rustfmt, Clippy, and rust-analyzer are included as product branches.
Main entry points: adjust_fulfillment_errors.rs Type Checking · main.rs rustc Driver · ast.rs AST Parsing · lib.rs AST Lowering
Components 18
Compiler
- rustc Driver
compiler/rustc/src/main.rs - AST Parsing
compiler/rustc_ast/src/ast.rs - AST Lowering
compiler/rustc_ast_lowering/src/lib.rs - MIR Transforms
compiler/rustc_mir_transform/src/pass_manager.rs - LLVM Codegen
compiler/rustc_codegen_llvm/src/base.rs
Semantic Analysis
- Type Checking
compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs - Type Inference
compiler/rustc_infer/src/infer/mod.rs - Trait Solving
compiler/rustc_trait_selection/src/traits/engine.rs - Obligation Engine
compiler/rustc_infer/src/traits/engine.rs - Borrow Checking
compiler/rustc_borrowck/src/lib.rs
Runtime Libraries
- Standard Library
library/std/src/lib.rs
Docs and Tools
- Rustdoc
src/librustdoc/lib.rs - Rustfmt
src/tools/rustfmt/src/bin/main.rs - Clippy
- Rust Analyzer
src/tools/rust-analyzer/crates/tt/src/storage.rs
Other components
- Developer
- Rust Source
- Compiled Program
Connections 18
- Developer → Rust Source: writes
- Rust Source → rustc Driver: submits source
- rustc Driver → AST Parsing: parses
- AST Parsing → AST Lowering: lowers
- AST Lowering → Type Checking: checks types
- Type Checking → Type Inference: uses inference
- Type Checking → Trait Solving: solves traits
- Trait Solving → Obligation Engine: registers obligations
compiler/rustc_trait_selection/src/traits/engine.rs - Type Inference → Obligation Engine: supports solving
compiler/rustc_infer/src/traits/engine.rs - Type Checking → Borrow Checking: hands off analysis
- Borrow Checking → MIR Transforms: checks MIR
- MIR Transforms → LLVM Codegen: provides MIR
- LLVM Codegen → Compiled Program: emits program
- rustc Driver → Standard Library: uses library
- Developer → Rustdoc: generates documentation
README.md - Developer → Rustfmt: formats code
README.md - Developer → Clippy: lints code
README.md - Developer → Rust Analyzer: uses editor support
README.md