Hacking rustc
Contributing to the Compiler
Esteban Küber
@ekuber
@estebank
Hacking rustc
Contributing to the Compiler
Esteban Küber
@ekuber
@estebank
Hacking rustc
Contributing to the Compiler
You can
v
x
/
e
Esteban Küber
@ekuber
@estebank
optimization passes
Parser
type inference
lifetime analysis
rustc: it’s “just” a program
rustc: it’s “just” a program
*
*terms and conditions apply
What are YOU interested in?
Get yourself ready
Find things to do
Finding things to do:
-You already know what you want to do
- found something broken?
- want something we don’t have?
Adding new things to Rust
The RFC process is to propose new language features to the lang team
The MCP “Major Change Proposal” process is for changes to the compiler
Finding things to do:
-You already know what you want to do
- found something broken?
- want something we don’t have?
- Check the backlog for
bugs and feature requests
Settings things up
get ready to wait
git
cmake
python
VIDEO
VIDEO
get ready to wait
x.py
like cargo, but for the compiler
rustup toolchain link dev \
~/rust/build/x86_64-apple-darwin/stage1/
rustc +dev file.rs
cargo +dev build
# contents of my config.toml
# Includes one of the default files in src/bootstrap/defaults
profile = "compiler"
changelog-seen = 2
[rust]
debug = true
debug-assertions = false
debuginfo-level = 1
debuginfo-level-rustc = 1
debuginfo-level-std = 1
run-dsymutil = true
RUSTC_LOG=path::to::module::I::care::about=info \
rustc +dev file.rs
Resources:
https://rustc-dev-guide.rust-lang.org
Resources:
https://rust-lang.zulipchat.com/
Resources:
Resources:
RUST_BACKTRACE=1 \
rustc +dev file.rs \
-Ztreat-err-as-bug=1
SCREEN SHOT OF BACKTRACE
The compiler
...
...
The compiler
vec
Vec
let x = 1i32;
let y = vec![1, 2, 3];
let z = y[x]; // 🙅♀️
...
The compiler
...
The compiler
we need more time
the rust compiler is big
working on it can be slow
IT’S WORTH IT
thank you for listening!
enjoy the rest of RustConf