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.
LLVM
19.6.
RISC-V
19.7.
WASI
19.8.
WebAssembly
19.9.
Windows
19.10.
Rust for Linux
20.
Licenses
21.
Editions
Bootstrapping
22.
Prologue
23.
What Bootstrapping does
24.
How Bootstrap does it
High-level Compiler Architecture
25.
Prologue
26.
Overview of the compiler
27.
The compiler source code
28.
Queries: demand-driven compilation
❱
28.1.
The Query Evaluation Model in Detail
28.2.
Incremental compilation
28.3.
Incremental compilation In Detail
28.4.
Debugging and Testing
28.5.
Salsa
29.
Memory Management in Rustc
30.
Serialization in Rustc
31.
Parallel Compilation
32.
Rustdoc internals
❱
32.1.
Search
Source Code Representation
33.
Prologue
34.
Syntax and the AST
❱
34.1.
Lexing and Parsing
34.2.
Macro expansion
34.3.
Name resolution
34.4.
Attributes
34.5.
#[test] Implementation
34.6.
Panic Implementation
34.7.
AST Validation
34.8.
Feature Gate Checking
34.9.
Lang Items
35.
The HIR (High-level IR)
❱
35.1.
Lowering AST to HIR
35.2.
Debugging
36.
The THIR (Typed High-level IR)
37.
The MIR (Mid-level IR)
❱
37.1.
MIR construction
37.2.
MIR visitor and traversal
37.3.
MIR queries and passes: getting the MIR
38.
Inline assembly
Supporting Infrastructure
39.
Command-line arguments
40.
rustc_driver and rustc_interface
❱
40.1.
Example: Type checking
40.2.
Example: Getting diagnostics
41.
Errors and Lints
❱
41.1.
Diagnostic and subdiagnostic structs
41.2.
Translation
41.3.
LintStore
41.4.
Error codes
41.5.
Diagnostic items
41.6.
ErrorGuaranteed
Analysis
42.
Prologue
43.
Generic parameter definitions
❱
43.1.
EarlyBinder and instantiating parameters
44.
Binders and Higher ranked regions
❱
44.1.
Instantiating binders
45.
Early vs Late bound parameters
46.
The ty module: representing types
❱
46.1.
ADTs and Generic Arguments
46.2.
Parameter types/consts/regions
47.
TypeFolder and TypeFoldable
48.
Parameter Environments
❱
48.1.
What is it?
48.2.
How are ParamEnv's constructed internally
48.3.
Which ParamEnv do I use?
49.
Type inference
50.
Trait solving
❱
50.1.
Higher-ranked trait bounds
50.2.
Caching subtleties
50.3.
Implied bounds
50.4.
Specialization
50.5.
Chalk-based trait solving
❱
50.5.1.
Lowering to logic
50.5.2.
Goals and clauses
50.5.3.
Canonical queries
50.5.4.
Canonicalization
50.6.
Next-gen trait solving
❱
50.6.1.
Invariants of the type system
50.6.2.
The solver
50.6.3.
Canonicalization
50.6.4.
Coinduction
50.6.5.
Caching
50.6.6.
Proof trees
50.6.7.
Normalization
50.6.8.
Opaque types
50.6.9.
Significant changes and quirks
50.7.
Unsize and CoerceUnsized traits
51.
Type checking
❱
51.1.
Method Lookup
51.2.
Variance
51.3.
Coherence Checking
51.4.
Opaque Types
❱
51.4.1.
Inference details
51.4.2.
Return Position Impl Trait In Trait
51.4.3.
Region inference restrictions
52.
Effect checking
53.
Pattern and Exhaustiveness Checking
54.
Unsafety Checking
55.
MIR dataflow
56.
Drop elaboration
57.
The borrow checker
❱
57.1.
Tracking moves and initialization
❱
57.1.1.
Move paths
57.2.
MIR type checker
57.3.
Drop check
57.4.
Region inference
❱
57.4.1.
Constraint propagation
57.4.2.
Lifetime parameters
57.4.3.
Member constraints
57.4.4.
Placeholders and universes
57.4.5.
Closure constraints
57.4.6.
Error reporting
57.5.
Two-phase-borrows
58.
Closure capture inference
59.
Async closures/"coroutine-closures"
MIR to Binaries
60.
Prologue
61.
MIR optimizations
62.
Debugging MIR
63.
Constant evaluation
❱
63.1.
Interpreter
64.
Monomorphization
65.
Lowering MIR
66.
Code Generation
❱
66.1.
Updating LLVM
66.2.
Debugging LLVM
66.3.
Backend Agnostic Codegen
66.4.
Implicit Caller Location
67.
Libraries and Metadata
68.
Profile-guided Optimization
69.
LLVM Source-Based Code Coverage
70.
Sanitizers Support
71.
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