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.
Codegen backend testing
❱
2.6.1.
Cranelift codegen backend
2.6.2.
GCC codegen backend
2.7.
Performance testing
2.8.
Suggest tests tool
2.9.
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
35.
Autodiff internals
❱
35.1.
Installation
35.2.
How to debug
35.3.
Autodiff flags
35.4.
Current limitations
Source Code Representation
36.
Prologue
37.
Syntax and the AST
❱
37.1.
Lexing and parsing
37.2.
Macro expansion
37.3.
Name resolution
37.4.
Attributes
37.5.
#[test] implementation
37.6.
Panic implementation
37.7.
AST validation
37.8.
Feature gate checking
37.9.
Lang Items
38.
The HIR (High-level IR)
❱
38.1.
Lowering AST to HIR
38.2.
Debugging
39.
The THIR (Typed High-level IR)
40.
The MIR (Mid-level IR)
❱
40.1.
MIR construction
40.2.
MIR visitor and traversal
40.3.
MIR queries and passes: getting the MIR
41.
Inline assembly
Supporting Infrastructure
42.
Command-line arguments
43.
rustc_driver and rustc_interface
❱
43.1.
Example: Type checking
43.2.
Example: Getting diagnostics
43.3.
Remarks on perma-unstable features
44.
Errors and lints
❱
44.1.
Diagnostic and subdiagnostic structs
44.2.
Translation
44.3.
LintStore
44.4.
Error codes
44.5.
Diagnostic items
44.6.
ErrorGuaranteed
Analysis
45.
Prologue
46.
Generic parameter definitions
❱
46.1.
EarlyBinder and instantiating parameters
47.
Binders and Higher ranked regions
❱
47.1.
Instantiating binders
48.
Early vs Late bound parameters
49.
The ty module: representing types
❱
49.1.
ADTs and Generic Arguments
49.2.
Parameter types/consts/regions
50.
TypeFolder and TypeFoldable
51.
Typing/Param Envs
52.
Type inference
53.
Trait solving
❱
53.1.
Higher-ranked trait bounds
53.2.
Caching subtleties
53.3.
Implied bounds
53.4.
Specialization
53.5.
Chalk-based trait solving
❱
53.5.1.
Lowering to logic
53.5.2.
Goals and clauses
53.5.3.
Canonical queries
53.5.4.
Canonicalization
53.6.
Next-gen trait solving
❱
53.6.1.
Invariants of the type system
53.6.2.
The solver
53.6.3.
Canonicalization
53.6.4.
Coinduction
53.6.5.
Caching
53.6.6.
Proof trees
53.6.7.
Normalization
53.6.8.
Opaque types
53.6.9.
Significant changes and quirks
53.7.
Unsize and CoerceUnsized traits
54.
Type checking
❱
54.1.
Method Lookup
54.2.
Variance
54.3.
Coherence checking
54.4.
Opaque types
❱
54.4.1.
Inference details
54.4.2.
Return Position Impl Trait In Trait
54.4.3.
Region inference restrictions
55.
Const condition checking
56.
Pattern and Exhaustiveness Checking
57.
Unsafety checking
58.
MIR dataflow
59.
Drop elaboration
60.
The borrow checker
❱
60.1.
Tracking moves and initialization
❱
60.1.1.
Move paths
60.2.
MIR type checker
60.3.
Drop check
60.4.
Region inference
❱
60.4.1.
Constraint propagation
60.4.2.
Lifetime parameters
60.4.3.
Member constraints
60.4.4.
Placeholders and universes
60.4.5.
Closure constraints
60.4.6.
Error reporting
60.5.
Two-phase-borrows
61.
Closure capture inference
62.
Async closures/"coroutine-closures"
MIR to Binaries
63.
Prologue
64.
MIR optimizations
65.
Debugging MIR
66.
Constant evaluation
❱
66.1.
Interpreter
67.
Monomorphization
68.
Lowering MIR
69.
Code Generation
❱
69.1.
Updating LLVM
69.2.
Debugging LLVM
69.3.
Backend Agnostic Codegen
69.4.
Implicit Caller Location
70.
Libraries and Metadata
71.
Profile-guided Optimization
72.
LLVM Source-Based Code Coverage
73.
Sanitizers Support
74.
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
GCC codegen backend tests
TODO: please add some more information to this page.