On this page

0176. Retain the Rust bootstrap compiler through 1.0

Context

ADR-0002 chose Rust for the bootstrap compiler and scheduled a self-hosting decision once there were compile-speed measurements. The current compiler loads and checks Harness packages in Rust, lowers them to verified IR, and uses that IR for both C emission and the reference interpreter. Native builds hand emitted C and runtime headers to an external compiler and linker. Bootstrap decision · Backend decision

In the focused M16.5 sample, median emit-c took 11–25 ms and standalone C compilation and linking took 189–2,179 ms. M8.7 saw the same pattern on larger synthetic Linux inputs. The native artifact cache skips C compilation on a hit, and M8.7's flat-match results show how much an algorithmic fix in the existing compiler can recover when Rust-side work does dominate. M16.5 measurements · M8.7 measurements

Decision

Keep Rust as the canonical implementation and bootstrap path for the 1.0 compiler. Keep the C backend and reference interpreter from ADR-0003.

Self-hosting would exercise Harness on a demanding application and could reduce reliance on Rust over time. It would also require a supported seed compiler, a compatible source subset and a way to validate a compiler built by its predecessor. A port of the current pipeline would still incur the external C cost for programs built through that pipeline. The measured compile times support deferring that work beyond 1.0 hardening.

Consequences

Use stage measurements to decide where to improve build latency. Profile the Rust phases when they exceed a project’s latency budget, and measure cache behavior and external C work when those dominate.

Reopen this decision with a superseding ADR if representative workloads show a material Rust-side bottleneck after targeted optimization, or if self-hosting becomes an explicit product goal. First compare a bounded Harness implementation of a compiler phase against the Rust phase on the same inputs, with equivalent outputs, diagnostics and resource limits. A change of canonical compiler also requires a reproducible seed-to-self build, stable successive self-builds, and differential parity with Rust for program outputs, traps, and diagnostics on the existing suite across both backends. Retain the Rust compiler as an oracle and recovery path during that evaluation.