Jarred Sumner rewrote Bun’s 960,000 LOC Zig codebase in Rust in 6 days using AI assistance, with 99.8% of the existing test suite passing on Linux x64 glibc.
Key Takeaways
960,000 LOC translated from Zig to Rust; test suite passes on Linux x64 glibc, with other platforms pending.
Motivation is memory safety: lifetime enforcement, destructors, and explicit unsafe blocks surface problems that Zig left silent.
Rust compile speed matches Zig parity because Bun uses its own faster Zig-based compiler, not upstream Zig.
A blog post is planned covering benchmarks, memory usage, maintainability, and the literal AI-assisted rewrite process.
Sumner noted this was not a simple “Claude, rewrite with no mistakes” prompt; human oversight and iteration were required.
Hacker News Comment Review
Commenters broadly accept the safety rationale: Bun’s Zig codebase has a documented history of crashes and memory bugs, and Rust’s type system directly addresses that, even if unsafe blocks remain prevalent in the initial port.
Skepticism centers on code quality over correctness: the test suite passing is a prototype milestone, not a shipping signal. Eliminating unsafe, achieving idiomatic Rust, and validating performance parity are the real remaining work.
The AI-assisted translation method is debated. One counterpoint: LLMs optimize for whatever feedback loop you give them, so test-suite-only validation leaves performance regressions undetected unless benchmarks are included as constraints.
Notable Comments
@torben-friis: Questions whether the 960K LOC reflects original size, Rust verbosity, or LLM verbosity, while calling language translation “the one field AI is mature enough to near one-shot.”
@afavour: Notes Zig’s ecosystem visibility was largely Bun-dependent, making this port a significant blow to Zig’s mainstream adoption.