Bun Rewrites 960K Lines of Zig to Rust Using Claude
Key insights
- Claude converted 960,000 lines of Zig to Rust in six days via 6,755 commits, merging to main on May 14, 2026.
- The rewrite leaves 13,044 unsafe Rust blocks versus 73 in comparable hand-written Rust, quantifying the safety debt from AI-speed migration.
- Zig's no-AI-contributions policy directly forced the language switch after Anthropic acquired Bun in December 2025.
Why this matters
This is the first publicly documented case of a production runtime switching languages at million-line scale using an AI coding agent as the primary author, setting a new baseline for what AI-assisted migration is operationally capable of in 2026. The 13,044 unsafe block figure gives the industry a concrete data point on the quality tradeoff: AI translation can achieve functional correctness at speed but embeds structural technical debt that requires separate human audit cycles. For founders and technical leaders evaluating AI-assisted refactors, this case reframes the question from 'can AI do it' to 'what does the remediation backlog look like after it does.'
Summary
Bun, acquired by Anthropic in December 2025, just merged a roughly one-million-line pull request converting its entire Zig codebase to Rust — completed in six days with Claude acting as the primary coding agent across 6,755 commits.
The trigger was practical, not philosophical: Zig's core team has an explicit no-AI-contributions policy, which became untenable the moment Anthropic took ownership and Bun's engineers stopped writing code by hand. Rather than fight the upstream culture, the team switched languages entirely.
Essentially: (Anthropic, Bun) used an AI acquisition as the forcing function to execute a million-line language migration at a pace no human team could sustain.
- The rewrite passes 99.8% of Bun's existing test suite on Linux x64 and shrinks the binary by 3 to 8 MB.
- 13,044 unsafe blocks remain in the new Rust codebase, compared to 73 in a comparable Rust project written by hand, exposing the safety debt embedded in speed-optimized AI translation.
- Six days, 6,755 commits, one merged PR to main on May 14, 2026.
The unsafe block count is the number that will follow this migration for years: passing tests and shipping binaries is the easy part; auditing memory safety guarantees at that scale is the work that comes next.
Potential risks and opportunities
Risks
- The 13,044 unsafe Rust blocks represent unaudited memory-safety exposure in a widely-used JavaScript runtime; a single exploitable block in a high-traffic code path could produce a critical CVE within months of broad adoption.
- Bun's downstream ecosystem (frameworks, edge runtimes, CI tooling built on Bun) faces potential breakage if the 0.2% failing tests surface on non-Linux platforms where Bun has significant adoption.
- If the AI-translated codebase produces correctness bugs not caught by the existing test suite, Anthropic faces reputational damage specifically tied to Claude's reliability as a code migration agent at scale.
Opportunities
- Rust safety audit tooling vendors (Veracode, ShiftLeft, Embark Studios' open-source toolchain) are positioned to pitch automated unsafe-block triage directly to Bun and to any team planning similar AI-driven migrations.
- Cloud and edge runtime providers (Cloudflare Workers, Deno Deploy, Fastly Compute) can use the unsafe-block disclosure to differentiate their own hand-audited Rust runtimes on security grounds in enterprise sales cycles.
- Anthropic can productize this migration workflow as a documented Claude use case, accelerating enterprise deals with large organizations sitting on legacy C or Zig codebases that have resisted rewrite due to cost and timeline risk.
What we don't know yet
- Whether the 99.8% test pass rate covers Bun's macOS and Windows targets, or only the confirmed Linux x64 results reported at merge time.
- No timeline or resourcing plan has been disclosed for auditing or reducing the 13,044 unsafe blocks to production-acceptable levels.
- The extent to which Anthropic's internal Claude deployment (model version, context window, tooling scaffolding) differs from what external Claude users could replicate for a similar migration.
Originally reported by theregister.com
Read the original article →Original headline: Anthropic-Owned Bun Rewrites 960K Lines of Zig to Rust With Claude as Coding Agent in Six Days — 1-Million-Line PR Merged to Main