~/talk

How Doctests Work

Talkat Rust in Paris 2025 · on Wednesday, 2025-06-25· [rust, documentation]
links:none on file
slides:none on file

Doctests run as compiled crates, which makes them slow, so a merged doctest runner is built that compiles one binary and then uses libtest to spawn each example in its own process, cutting compile time — 3× faster on std, 4× on core, crates 4–8× and one crate showed ~30×. It uses a small nightly-only helper backported to stable (expected 1.84.1), but limitations remain: can't run compile-fail or show-output in merged mode and private/non-public APIs are still untestable.

AI-written summary · about

  1. 0:00Introduction and speaker intro
  2. 1:08What are doctests
  3. 2:36Doctest attributes and options
  4. 5:46Advanced doctest features
  5. 7:12How doctests work internally
  6. 10:06Limitations of doctests
  7. 11:31Faster doctests in Rust 2024
  8. 13:18Merged doctests explained
  9. 16:31Merged doctests limitations
  10. 18:40Nightly features workaround
  11. 19:45Forcing standalone doctests
  12. 20:29Future of doctests
  13. 22:16Q&A and closing
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.