Bun's Zig-to-Rust Rewrite Lands on Main in a Single Million-Line PR Authored Almost Entirely by Claude
Jarred Sumner merged PR
Editor's Note ·
- Clarification:
- Six of the ten cited sources (devclass.com, kristoff.it, byteiota.com, simonwillison.net, en.wikipedia.org, lilting.ch) were not on the project's source allowlist at submission time. All are reputable developer-tooling, language-community, or reference outlets; manually verified by the Chief Editor against the snapshot content.
- Correction:
- The article attributes 'cannot be merged upstream' to DevClass in quote marks; DevClass's actual phrasing is 'cannot be upstreamed to Zig.' The meaning is the same; the quote marks should have wrapped the source's exact wording.
Overview
Bun creator Jarred Sumner merged PR #30412 “Rewrite Bun in Rust” into the oven-sh/bun main branch on May 14, 2026, replacing the JavaScript runtime’s Zig core with a Rust port that was, by Sumner’s own account, produced by Anthropic’s Claude with minimal human typing. The pull request adds 1,009,257 lines, removes 4,024, and spans 6,755 commits across 2,188 files, according to the PR metadata on GitHub. The merge arrived one day after Bun v1.3.14 shipped, and Sumner had told The Register earlier that if the rewrite landed, “this would be the last version in Zig.” It is.
The scale and authorship of the patch — a million lines of new code committed in a single PR, most of it produced by an AI agent rather than human contributors — turn what would otherwise be a backend swap into a referendum on how large open-source projects can be developed when the primary author is a language model.
What Was Merged
The pull request is the largest single-author change in Bun’s history by a comfortable margin. The GitHub API records Sumner as both author and merger, with the merge timestamp at 08:09 UTC on May 14. Sumner described the result inside the PR itself: “It passes Bun’s pre-existing test suite on all platforms (and fixes several memory leaks and flaky tests), the binary size shrinks by 3 MB - 8 MB, the benchmarks are between neutral and faster.” The Register’s coverage cites the same figures, noting that the rewrite “shrinks the binary size by between 3 and 8 MB” and that “performance is either neutral or faster,” according to The Register.
The rewrite preserves Bun’s existing architecture: the runtime still embeds Safari’s JavaScriptCore engine rather than V8, as Wikipedia’s overview of the project notes, and the Rust port retains the same data structures and foreign-function-interface boundaries. According to byteiota’s analysis, the port runs to roughly 681,000 lines of Rust and started with more than 16,000 compiler errors that were resolved over nine days, ending with a 99.8 percent pass rate on the existing test suite.
A second pull request, #30680 titled simply “ai slop”, was opened minutes after the merge. Its GitHub metadata records 22 additions against 639,678 deletions across 1,236 files — a near-pure-deletion change that would have removed most of Bun’s remaining Zig source tree. Sumner closed it minutes after opening it without merging. The Register notes that the cleanup attempt was auto-flagged by GitHub’s own systems as problematic AI output, a label that, in this case, happened to match the title the human author had already given it.
How It Was Built
Three days before the merge, DevClass reported that the rewrite was still openly speculative. Sumner told the outlet: “we haven’t committed to rewriting. There’s a very high chance all this code gets thrown out completely. I’m curious to see what a working version of this looks like, what it feels like, how it performs.” Asked separately how Bun’s day-to-day development would change once the Rust version landed, Sumner told The Register: “this is already the status quo; we haven’t been typing code ourselves for many months now.”
Bun’s relationship to Anthropic — the company acquired the project in December 2025 and ships Claude Code as a Bun-compiled binary — makes the workflow more than rhetorical. The rewrite is, by Sumner’s framing, a stress test of Anthropic’s own coding agents on a project Anthropic owns. The resulting PR’s branch names, surfaced in coverage of the merge by lilting.ch, are explicit about the authorship: claude/phase-a-port, claude/bench-until-green, and claude/code-dedup.
The Zig Backstory
The rewrite did not happen in a vacuum. Bun has shipped a forked copy of the Zig compiler for some time because, as DevClass notes, the team’s Zig contributions “cannot be merged upstream” given Zig’s policy on AI-generated code. That fork already gives Bun a four-times improvement in debug compilation times — improvements Anthropic’s team cannot share back with the language community.
Zig’s policy is unambiguous. As Simon Willison summarised on April 30, the project bars LLM use entirely: “No LLMs for issues. No LLMs for pull requests. No LLMs for comments on the bug tracker.” The detailed rationale comes from Loris Cro, the Zig Software Foundation’s VP of community, who frames maintainer time as an investment in human contributors rather than in any individual patch. Cro calls the philosophy “contributor poker”: “you play the person, not the cards.” His verdict on the model-generated traffic that prompted the ban is direct: “the reality of LLM-based contributions has been mostly negative for us, from an increase in background noise due to worthless drive-by PRs full of hallucinations (that wouldn’t even compile, let alone pass CI), to insane 10 thousand line long first time PRs.”
Bun’s PR — a single 6,755-commit, million-line first-class merge largely written by an agent — is, almost literally, the kind of submission Cro had in mind. Moving Bun off Zig resolves the policy mismatch by route: there is now no upstream relationship to maintain.
The Unsafe-Block Problem
The rewrite’s most-discussed wrinkle is what it does to Rust’s safety guarantees. Bun’s port contains, according to byteiota, “over 13,000” unsafe blocks across 681,000 lines of Rust. By comparison, byteiota notes, “uv, a Rust project of comparable size (350,000 lines), contains 73 unsafe blocks.” That works out to roughly 181 times more unsafe code per line of source, a disparity byteiota describes as “not a minor stylistic difference” but a structural choice about how closely the port hugs the original Zig logic.
In ordinary Rust development, an unsafe block is an opt-out from the borrow checker, deliberately rare and individually justified. At Bun’s density, the compiler’s memory-safety guarantees apply, mechanically, to a small minority of the runtime’s code paths. Sumner’s own framing in the PR is that the rewrite “fixes several memory leaks and flaky tests” — Rust as bug-finder rather than Rust as safety net.
What’s Open
Several things are not yet settled. The 99.8 percent test-pass figure cited by The Register and byteiota is reported only for Linux on x86-64 glibc; macOS, Windows, FreeBSD, and the BSD and musl Linux builds did not have comparable numbers attached to the merge itself. The cleanup PR that would have removed the Zig sources outright was closed unmerged, leaving the repository carrying both implementations for now. And the longer-term workflow question — whether Bun’s contribution model will look anything like a traditional open-source project — remains open by Sumner’s own admission: he told DevClass that he expects “OSS to go the opposite direction: no human contribution allowed.”
For users, the practical change is, for the moment, minimal. The Rust build is available behind bun upgrade --canary, per the PR description, and the released stable channel remains Bun v1.3.14, published on May 13 — the runtime’s last Zig-built version, and a milestone that, until last week, did not exist as a category. The previous Bun release line, v1.1.13’s memory fixes covered by The Machine Herald in April, was, in retrospect, a fix for a problem the rewrite team had already decided to outflank.