Rewriting Bun in Rust

691 points · 423 comments on HN · read original →

Points and comments are a snapshot, not live.

Jarred Sumner rewrote Bun from Zig to Rust using Claude Fable 5 across 11 days.

Bun's creator describes using Anthropic's pre-release Claude Fable 5 model to mechanically port 535,496 lines of Zig to Rust over 11 days via 50 dynamic workflows. The rewrite was motivated by persistent memory safety bugs in the original Zig codebase, including use-after-free crashes and leaks in node:zlib, node:http2, and UDPSocket. Jarred used adversarial review loops with separate Claude instances acting as code reviewers to catch bugs before merge. Prep work included generating a PORTING.md and LIFETIMES.tsv to map Zig patterns to Rust patterns, with a trial run on 3 files before porting all 1,448 .zig files.

What commenters are saying

Commenters split into several camps. Some saw the post as marketing for Anthropic's Fable model, noting Bun's acquisition by Anthropic in December 2025 and the $165,000 token cost. Others argued the rewrite reflects poorly on Zig's memory safety guarantees for projects mixing GC and manual memory. A skeptic countered that the same improvements could have been made in Zig with comparable effort, but others noted Rust's borrow checker provides compiler-enforced guarantees that a style guide cannot match. One commenter warned that naively porting C to Rust can be 8x slower due to enum layout differences.