About this guide
Getting Started
Building and debugging rustc
1.
How to Build and Run the Compiler
❱
1.1.
Prerequisites
1.2.
Suggested Workflows
1.3.
Distribution artifacts
1.4.
Building Documentation
1.5.
Rustdoc overview
1.6.
Adding a new target
2.
Testing the compiler
❱
2.1.
Running tests
❱
2.1.1.
Testing with Docker
2.1.2.
Testing with CI
2.2.
Adding new tests
2.3.
Compiletest
❱
2.3.1.
UI tests
2.3.2.
Test headers
2.4.
Performance testing
2.5.
Crater
3.
Debugging the Compiler
❱
3.1.
Using the tracing/logging instrumentation
4.
Profiling the compiler
❱
4.1.
with the linux perf tool
4.2.
with Windows Performance Analyzer
5.
crates.io Dependencies
Contributing to Rust
6.
Introduction
7.
About the compiler team
8.
Using Git
9.
Mastering @rustbot
10.
Walkthrough: a typical contribution
11.
Bug Fix Procedure
12.
Implementing new features
13.
Stability attributes
14.
Stabilizing Features
15.
Feature Gates
16.
Coding conventions
17.
Notification groups
❱
17.1.
ARM
17.2.
Cleanup Crew
17.3.
LLVM
17.4.
RISC-V
17.5.
Windows
18.
Licenses
High-level Compiler Architecture
19.
Prologue
20.
Overview of the Compiler
21.
The compiler source code
22.
Bootstrapping
23.
Queries: demand-driven compilation
❱
23.1.
The Query Evaluation Model in Detail
23.2.
Incremental compilation
23.3.
Incremental compilation In Detail
23.4.
Debugging and Testing
23.5.
Salsa
24.
Memory Management in Rustc
25.
Serialization in Rustc
26.
Parallel Compilation
27.
Rustdoc internals
Source Code Representation
28.
Prologue
29.
Command-line arguments
30.
The Rustc Driver and Interface
❱
30.1.
Example: Type checking
30.2.
Example: Getting diagnostics
31.
Syntax and the AST
❱
31.1.
Lexing and Parsing
31.2.
Macro expansion
31.3.
Name resolution
31.4.
#[test] Implementation
31.5.
Panic Implementation
31.6.
AST Validation
31.7.
Feature Gate Checking
31.8.
Lang Items
32.
The HIR (High-level IR)
❱
32.1.
Lowering AST to HIR
32.2.
Debugging
33.
The THIR (Typed High-level IR)
34.
The MIR (Mid-level IR)
❱
34.1.
MIR construction
34.2.
MIR visitor and traversal
34.3.
MIR passes: getting the MIR for a function
35.
Identifiers in the Compiler
36.
Closure expansion
37.
Inline assembly
Analysis
38.
Prologue
39.
The ty module: representing types
❱
39.1.
Generics and substitutions
39.2.
TypeFolder and TypeFoldable
39.3.
Generic arguments
39.4.
Constants in the type system
40.
Type inference
41.
Trait solving
❱
41.1.
Early and Late Bound Parameters
41.2.
Higher-ranked trait bounds
41.3.
Caching subtleties
41.4.
Specialization
41.5.
Chalk-based trait solving
❱
41.5.1.
Lowering to logic
41.5.2.
Goals and clauses
41.5.3.
Canonical queries
41.6.
Next-gen trait solving
❱
41.6.1.
The solver
41.6.2.
Canonicalization
41.6.3.
Coinduction
42.
Type checking
❱
42.1.
Method Lookup
42.2.
Variance
42.3.
Opaque Types
❱
42.3.1.
Inference details
43.
Pattern and Exhaustiveness Checking
44.
MIR dataflow
45.
Drop elaboration
46.
The borrow checker
❱
46.1.
Tracking moves and initialization
❱
46.1.1.
Move paths
46.2.
MIR type checker
46.3.
Region inference
❱
46.3.1.
Constraint propagation
46.3.2.
Lifetime parameters
46.3.3.
Member constraints
46.3.4.
Placeholders and universes
46.3.5.
Closure constraints
46.3.6.
Error reporting
46.4.
Two-phase-borrows
47.
Parameter Environments
48.
Errors and Lints
❱
48.1.
Diagnostic and subdiagnostic structs
48.2.
Translation
48.3.
LintStore
48.4.
Diagnostic codes
48.5.
Diagnostic items
48.6.
ErrorGuaranteed
MIR to Binaries
49.
Prologue
50.
MIR optimizations
51.
Debugging
52.
Constant evaluation
❱
52.1.
Interpreter
53.
Monomorphization
54.
Lowering MIR
55.
Code Generation
❱
55.1.
Updating LLVM
55.2.
Debugging LLVM
55.3.
Backend Agnostic Codegen
55.4.
Implicit Caller Location
56.
Libraries and Metadata
57.
Profile-guided Optimization
58.
LLVM Source-Based Code Coverage
59.
Sanitizers Support
60.
Debugging Support in the Rust Compiler
Appendix A: Background topics
Appendix B: Glossary
Appendix C: Code Index
Appendix D: Compiler Lecture Series
Appendix E: Bibliography
Appendix Z: HumorRust
Light (default)
Rust
Coal
Navy
Ayu
Guide to Rustc Development
Reporting region errors
TODO: we should discuss how to generate errors from the results of these analyses.