Procedural Macros vs Sliced Bread
summary
Claim: procedural macros are game changing; the talk shows what that means concretely. It cites the history (derive lands mid‑2016 and derive macros stabilized Oct 2018), shows real tooling — syn and quote crates plus proc_macro TokenStream — and demonstrates outcomes: Serde becomes wildly popular, structopt and no_panic get implemented, macro output must preserve spans so compiler diagnostics stay useful, and hygiene remains an open problem.
AI-written summary · about
chapters (17)
- 0:00Intro
- 0:31Rise of Procedural Macros
- 3:05Rise of Sliced Bread
- 4:41The proc-macro crate type
- 5:02println! (...)
- 7:58TokenStream?
- 8:47Token Tree? enun Token Tree Group (Group) Ident (Ident)
- 11:04Modularized Macros
- 14:44Parsing with syn
- 16:11Expanding with quote
- 17:36Interpolation in quote
- 18:55Working with Span
- 20:46Hygiene
- 22:49Diagnostics API
- 23:36Debugging Macros
- 26:01Procedural Macro Gallery
- 28:06Questions?
related talks
28mA gentle introduction to procedural macros
29mMacromancy: an introduction to Rust macros
26mMy Little Procedural Macro
24mMacros for a More Productive Rust
25mPowerful Macros, Good IDE Support, No Headaches. Choose Two
39mRust metaprogramming - macro_rules! beyond basics
18mImpractical Macros
26mMaking life easier with Derive and other tools
