The Million-Line Demo: When Anthropic Rewrote Bun in Rust and Called It Safety

Friday 10 July 2026 topic: Anthropic's AI-generated Rust rewrite of Bun is a product showcase masquerading as engineering, and the memory-safety claims don't survive contact with the codebase

Chart chart-1.png

Jarred Sumner’s blog post announcing the Rust rewrite of Bun reads like two documents stitched together. The first is a sincere engineering memoir — a young developer who built a JavaScript runtime in Zig, accumulated a harrowing list of use-after-free bugs and memory leaks, and decided the language’s manual memory management was the root cause. The second is a product demo for Anthropic, which acquired Bun in December 2025. Buried in a disclosure paragraph: Sumner used “a pre-release version of Claude Fable 5 for much of the Rust rewrite.” The post is expertly written. As Zig creator Andrew Kelley put it: “It’s almost like the marketing department of a trillion dollar company has a lot of money riding on this article.”

The rewrite is genuinely impressive as a feat of AI code generation. A single developer, using Claude, ported roughly 600,000 lines of Zig into over one million lines of Rust, passing 99.8% of Bun’s existing test suite on Linux x64. The binary is 3–8 MB smaller. Sumner says performance is “neutral or faster.” By any conventional measure, this is the most ambitious agentic coding achievement yet publicised — a production runtime with 22 million monthly downloads, rewritten largely by a machine. But the framing — that Rust’s borrow checker and Drop trait will systematically eliminate the use-after-free and double-free bugs that plagued the Zig codebase — is where the story starts to fray.

The problem is that the AI-generated Rust code contains approximately 13,000 instances of unsafe, the keyword that disables the very safety guarantees the rewrite was supposed to deliver. A GitHub issue filed after the merge demonstrated that PathString::slice produces undefined behaviour through a dangling reference — and this was in code labelled “safe” Rust, not inside an unsafe block. No Miri tests (Rust’s UB detector) were included in CI at merge time. As HN commenter @dfabulich observed: “He makes it sound like Claude did a fantastic Rust rewrite, and ‘the work continues.’ But when the Rust port merged to main, the state of the code was very, very bad.” The test suite that Sumner credits with validating the rewrite is the same test suite he says failed to catch the Zig bugs that motivated the rewrite in the first place. As Kelley noted: “It’s not sufficient to catch bugs in Zig code but it is sufficient to catch bugs in 1 million lines of unreviewed slop?”

The deeper tension is institutional. Bun is no longer an independent project — it’s an Anthropic asset, and the Rust rewrite doubles as a Claude Fable 5 showcase. Sumner confirmed that “we haven’t been typing code ourselves for many months now,” even pre-acquisition. The Zig community had a zero-LLM policy, and Bun had been maintaining a forked Zig compiler with AI-generated patches that could never be merged upstream. Kelley’s rebuttal reveals that ZSF considered Bun “a net liability” even before the AI era — the codebase was already “hacks on top of hacks” — but the Anthropic acquisition and the flood of “drive-by slop contributions” it triggered made the break permanent. One HN commenter summed up the mood: “Bun is slop. Let’s not pretend it is not. It went from 600k lines of zig to almost a million of rust, for a wrapper around a js engine.”

The real story isn’t “AI rewrote a runtime.” It’s that a trillion-dollar company acquired a widely-depended-upon open-source project, used it as a testbed for its own unreleased model, shipped a million lines of largely unreviewed code to production, and framed the result as a safety improvement — when the evidence suggests the new codebase trades one class of memory bugs for another, hidden behind 13,000 unsafe escape hatches and a test suite that was never sufficient to begin with. Rust doesn’t make code safe; it makes safe code verifiable. If nobody is reading the code — and by Sumner’s own admission, nobody is — the borrow checker is just a compiler flag with better marketing.

Sources