Getting Started
About this guide
Building and debugging rustc
1.
How to build and run the compiler
❱
1.1.
Quickstart
1.2.
Prerequisites
1.3.
Suggested Workflows
1.4.
Distribution artifacts
1.5.
Building Documentation
1.6.
Rustdoc overview
1.7.
Adding a new target
1.8.
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.
Best practices
2.4.
Compiletest
❱
2.4.1.
UI tests
2.4.2.
Test directives
2.4.3.
Minicore
2.5.
Ecosystem testing
❱
2.5.1.
Crater
2.5.2.
Fuchsia
2.5.3.
Rust for Linux
2.6.
Performance testing
2.7.
Suggest tests tool
2.8.
Misc info
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
4.3.
with the Rust benchmark suite
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.
Apple
19.2.
ARM
19.3.
Cleanup Crew
19.4.
Emscripten
19.5.
Fuchsia
19.6.
LLVM
19.7.
RISC-V
19.8.
Rust for Linux
19.9.
WASI
19.10.
WebAssembly
19.11.
Windows
20.
Licenses
21.
Editions
Bootstrapping
22.
Prologue
23.
What Bootstrapping does
24.
How Bootstrap does it
25.
Writing tools in Bootstrap
26.
Debugging bootstrap
High-level Compiler Architecture
27.
Prologue
28.
Overview of the compiler
29.
The compiler source code
30.
Queries: demand-driven compilation
❱
30.1.
The Query Evaluation Model in Detail
30.2.
Incremental compilation
30.3.
Incremental compilation In Detail
30.4.
Debugging and Testing
30.5.
Salsa
31.
Memory Management in Rustc
32.
Serialization in Rustc
33.
Parallel Compilation
34.
Rustdoc internals
❱
34.1.
Search
34.2.
The rustdoc test suite
Source Code Representation
35.
Prologue
36.
Syntax and the AST
❱
36.1.
Lexing and Parsing
36.2.
Macro expansion
36.3.
Name resolution
36.4.
Attributes
36.5.
#[test] Implementation
36.6.
Panic Implementation
36.7.
AST Validation
36.8.
Feature Gate Checking
36.9.
Lang Items
37.
The HIR (High-level IR)
❱
37.1.
Lowering AST to HIR
37.2.
Debugging
38.
The THIR (Typed High-level IR)
39.
The MIR (Mid-level IR)
❱
39.1.
MIR construction
39.2.
MIR visitor and traversal
39.3.
MIR queries and passes: getting the MIR
40.
Inline assembly
Supporting Infrastructure
41.
Command-line arguments
42.
rustc_driver and rustc_interface
❱
42.1.
Example: Type checking
42.2.
Example: Getting diagnostics
42.3.
Remarks on perma-unstable features
43.
Errors and Lints
❱
43.1.
Diagnostic and subdiagnostic structs
43.2.
Translation
43.3.
LintStore
43.4.
Error codes
43.5.
Diagnostic items
43.6.
ErrorGuaranteed
Analysis
44.
Prologue
45.
Generic parameter definitions
❱
45.1.
EarlyBinder and instantiating parameters
46.
Binders and Higher ranked regions
❱
46.1.
Instantiating binders
47.
Early vs Late bound parameters
48.
The ty module: representing types
❱
48.1.
ADTs and Generic Arguments
48.2.
Parameter types/consts/regions
49.
TypeFolder and TypeFoldable
50.
Typing/Param Envs
51.
Type inference
52.
Trait solving
❱
52.1.
Higher-ranked trait bounds
52.2.
Caching subtleties
52.3.
Implied bounds
52.4.
Specialization
52.5.
Chalk-based trait solving
❱
52.5.1.
Lowering to logic
52.5.2.
Goals and clauses
52.5.3.
Canonical queries
52.5.4.
Canonicalization
52.6.
Next-gen trait solving
❱
52.6.1.
Invariants of the type system
52.6.2.
The solver
52.6.3.
Canonicalization
52.6.4.
Coinduction
52.6.5.
Caching
52.6.6.
Proof trees
52.6.7.
Normalization
52.6.8.
Opaque types
52.6.9.
Significant changes and quirks
52.7.
Unsize and CoerceUnsized traits
53.
Type checking
❱
53.1.
Method Lookup
53.2.
Variance
53.3.
Coherence Checking
53.4.
Opaque Types
❱
53.4.1.
Inference details
53.4.2.
Return Position Impl Trait In Trait
53.4.3.
Region inference restrictions
54.
Const condition checking
55.
Pattern and Exhaustiveness Checking
56.
Unsafety Checking
57.
MIR dataflow
58.
Drop elaboration
59.
The borrow checker
❱
59.1.
Tracking moves and initialization
❱
59.1.1.
Move paths
59.2.
MIR type checker
59.3.
Drop check
59.4.
Region inference
❱
59.4.1.
Constraint propagation
59.4.2.
Lifetime parameters
59.4.3.
Member constraints
59.4.4.
Placeholders and universes
59.4.5.
Closure constraints
59.4.6.
Error reporting
59.5.
Two-phase-borrows
60.
Closure capture inference
61.
Async closures/"coroutine-closures"
MIR to Binaries
62.
Prologue
63.
MIR optimizations
64.
Debugging MIR
65.
Constant evaluation
❱
65.1.
Interpreter
66.
Monomorphization
67.
Lowering MIR
68.
Code Generation
❱
68.1.
Updating LLVM
68.2.
Debugging LLVM
68.3.
Backend Agnostic Codegen
68.4.
Implicit Caller Location
69.
Libraries and Metadata
70.
Profile-guided Optimization
71.
LLVM Source-Based Code Coverage
72.
Sanitizers Support
73.
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
Feature Gate Checking
TODO
: this chapter
#1158