Hraness
Theme
Appearance

saved

rustd: a build daemon for millisecond Rust edit loops

by DioxusLabsGitHubpublished

Hraness wrote this summary from a saved copy of the source. Quotations are taken word for word from the source.

gist

DioxusLabs' rustd is a prototype build daemon that keeps a Rust workspace loaded in rust-analyzer's database and compiles functions straight from its MIR with Cranelift. The aim is to cut the edit-to-running-code loop from seconds to tens of milliseconds while staying observably identical to rustc.

ideas

  • rustc is the oracle. Any behavioral difference from rustc's build counts as a rustd bug, and differential tests compare outputs of both binaries.
  • Skips are bugs, not a fallback. Unsupported functions are left to rustc, counted, and targeted to zero; the backend must never guess.
  • Four ranked metrics. Mismatches, skips, edit latency, then footprint; a change that helps a lower metric at a higher one's expense does not land.
  • A ladder of real crates. Targets climb from a corpus and small crates to serde_json, syn, ripgrep, async tokio services, and finally cargo and rust-analyzer.
  • Parallel workstreams. Work is split across subagent-owned areas such as ABI, trait objects, drop glue, the daemon, linking, and async.

quotes

“When they differ, rustd is wrong.”

RUSTD.md, rule 1.

“What the backend must never do is guess.”

RUSTD.md, on unsupported input.

“Get things working first, then optimise.”

RUSTD.md, on latency metrics.