Getting Started
About this guide
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
1.7.
Optimized build
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
2.6.
Suggest tests tool
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.
Contribution Procedures
7.
About the compiler team
8.
Using Git
9.
Mastering @rustbot
10.
Walkthrough: a typical contribution
11.
Implementing new language features
12.
Stability attributes
13.
Stabilizing Features
14.
Feature Gates
15.
Coding conventions
16.
Procedures for Breaking Changes
17.
Using external repositories
18.
Fuzzing
19.
Notification groups
❱
19.1.
ARM
19.2.
Cleanup Crew
19.3.
LLVM
19.4.
RISC-V
19.5.
Windows
20.
Licenses
High-level Compiler Architecture
21.
Prologue
22.
Overview of the compiler
23.
The compiler source code
24.
Bootstrapping
25.
Queries: demand-driven compilation
❱
25.1.
The Query Evaluation Model in Detail
25.2.
Incremental compilation
25.3.
Incremental compilation In Detail
25.4.
Debugging and Testing
25.5.
Salsa
26.
Memory Management in Rustc
27.
Serialization in Rustc
28.
Parallel Compilation
29.
Rustdoc internals
Source Code Representation
30.
Prologue
31.
Command-line arguments
32.
rustc_driver and rustc_interface
❱
32.1.
Example: Type checking
32.2.
Example: Getting diagnostics
33.
Syntax and the AST
❱
33.1.
Lexing and Parsing
33.2.
Macro expansion
33.3.
Name resolution
33.4.
#[test] Implementation
33.5.
Panic Implementation
33.6.
AST Validation
33.7.
Feature Gate Checking
33.8.
Lang Items
34.
The HIR (High-level IR)
❱
34.1.
Lowering AST to HIR
34.2.
Debugging
35.
The THIR (Typed High-level IR)
36.
The MIR (Mid-level IR)
❱
36.1.
MIR construction
36.2.
MIR visitor and traversal
36.3.
MIR passes: getting the MIR for a function
37.
Identifiers in the compiler
38.
Closure expansion
39.
Inline assembly
Analysis
40.
Prologue
41.
The ty module: representing types
❱
41.1.
Generics and substitutions
41.2.
TypeFolder and TypeFoldable
41.3.
Generic arguments
41.4.
Constants in the type system
41.5.
Bound vars and Parameters
42.
Type inference
43.
Trait solving
❱
43.1.
Early and Late Bound Parameter Definitions
❱
43.1.1.
What are early and late bound parameters
43.1.2.
Interactions with turbofishing
43.2.
Higher-ranked trait bounds
43.3.
Caching subtleties
43.4.
Specialization
43.5.
Chalk-based trait solving
❱
43.5.1.
Lowering to logic
43.5.2.
Goals and clauses
43.5.3.
Canonical queries
43.5.4.
Canonicalization
43.6.
Next-gen trait solving
❱
43.6.1.
Invariants of the type system
43.6.2.
The solver
43.6.3.
Canonicalization
43.6.4.
Coinduction
43.6.5.
Proof trees
43.6.6.
Normalization
43.7.
Unsize and CoerceUnsized traits
44.
Type checking
❱
44.1.
Method Lookup
44.2.
Variance
44.3.
Opaque Types
❱
44.3.1.
Inference details
44.3.2.
Return Position Impl Trait In Trait
45.
Effect checking
46.
Pattern and Exhaustiveness Checking
47.
MIR dataflow
48.
Drop elaboration
49.
The borrow checker
❱
49.1.
Tracking moves and initialization
❱
49.1.1.
Move paths
49.2.
MIR type checker
49.3.
Drop check
49.4.
Region inference
❱
49.4.1.
Constraint propagation
49.4.2.
Lifetime parameters
49.4.3.
Member constraints
49.4.4.
Placeholders and universes
49.4.5.
Closure constraints
49.4.6.
Error reporting
49.5.
Two-phase-borrows
50.
Parameter Environments
51.
Errors and Lints
❱
51.1.
Diagnostic and subdiagnostic structs
51.2.
Translation
51.3.
LintStore
51.4.
Error codes
51.5.
Diagnostic items
51.6.
ErrorGuaranteed
MIR to Binaries
52.
Prologue
53.
MIR optimizations
54.
Debugging
55.
Constant evaluation
❱
55.1.
Interpreter
56.
Monomorphization
57.
Lowering MIR
58.
Code Generation
❱
58.1.
Updating LLVM
58.2.
Debugging LLVM
58.3.
Backend Agnostic Codegen
58.4.
Implicit Caller Location
59.
Libraries and Metadata
60.
Profile-guided Optimization
61.
LLVM Source-Based Code Coverage
62.
Sanitizers Support
63.
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
Rust Compiler Development Guide
Reporting region errors
TODO: we should discuss how to generate errors from the results of these analyses.