In May 2026, Jarred Sumner rewrote 1,009,272 lines of Bun — one of the largest JavaScript runtimes ever built — from Zig to Rust in 11 days. Not with a team of engineers. With 64 parallel Claude instances, 4 Git worktrees, and roughly $165,000 in API credits. The rewrite fixed 128 bugs, cut peak memory usage by 90% in bundling workloads, and shrank the binary by 20%. It is the most concrete production data point in the Zig-versus-Rust debate to date, and it landed firmly on one side.
The Rewrite in Numbers
The scale is worth sitting with for a moment. Bun is not a toy project. It is a production JavaScript runtime used by millions of developers. Rewriting a million lines of code in 11 days — without skipping a single test — would have been considered reckless a year ago. In 2026, it is apparently just Thursday.
The specific bugs that forced the decision were memory-safety failures: use-after-free crashes in node:zlib, memory leaks in socket and file-watching operations, heap corruption triggered by JavaScript callbacks during iteration. Bun’s official post is blunt: “In safe Rust, these are compiler errors.” Zig’s manual memory model demands discipline at every call site. The borrow checker enforces it at compile time. When you’re mixing garbage-collected JavaScript values with manually-managed system memory at scale, the difference is not academic.
The results bore that out. Version 1.4.0 fixed all 128 reproducible bugs from 1.3.14. Bundling 2,000 projects dropped from 6.7 GB to 609 MB of peak memory. Startup time in Claude Code on Linux improved by 10%.
The Reason Nobody Is Talking About Enough
The memory safety argument is the clean story. The messier story is more interesting.
Anthropic acquired Bun in December 2025. Claude Code became central to Bun’s development workflow. And Zig has a firm, official policy: no AI-generated contributions. No LLMs for pull requests, issues, or bug tracker comments. Andrew Kelley, Zig’s creator, has called AI-generated code “invariably garbage.” Zig is one of four major open-source projects, out of 112 surveyed in March 2026, to implement a total ban on AI contributions.
That policy is coherent as community philosophy. It is a commercial exit ramp for a project under agentic development pressure. Bun’s AI-assisted fork had achieved a 4x compilation speedup that could not be upstreamed because of the ban. Once Anthropic’s acquisition made Claude Code the core development tool, staying on Zig was no longer a technical question. It was an organizational impossibility.
Zig Is Still Good at What It Does
None of this means Zig is bad. It is worth being honest about where Zig genuinely beats Rust, because the debate gets distorted when people ignore it.
- Comptime is legitimately exceptional. Zig’s compile-time code execution generates specialized data structures without runtime overhead in ways Rust’s macro system handles differently. Experienced systems programmers consistently cite it as Zig’s best feature.
- C interoperability is seamless. Zig can use any C library without writing bindings. For embedded systems and projects deeply integrated with existing C codebases, this is a meaningful practical advantage.
- The language fits in your head. No macros, no hidden control flow, no borrow checker fighting your design decisions. One commenter on Lobste.rs put it well: “I find Zig harder to write and easier to read than Rust. And in the AI era, I read more code than I write.” That’s a fair point.
Zig remains the right tool for embedded systems, custom allocators, firmware, and projects where C interoperability is the primary concern — especially those that do not use agentic coding workflows.
Why Rust Wins When AI Is Writing Your Code
The calculus shifts when you put AI coding agents in the loop, and the shift is not subtle.
Rust’s compiler error messages are specific, machine-readable, and well-represented in training data. AI coding agents iterate on them faster than almost any other language. The borrow checker — often criticized as a productivity tax for human engineers — becomes a safety net when you’re generating code at a volume no human can fully review. Bun developers found that of their last 150 merged PRs, 108 involved memory-safety-adjacent bugs that would not compile in Rust. That is 72% of your code review coverage from the type system alone.
The broader ecosystem confirms the direction. Enterprise Rust adoption reached 48.8% in the 2025 State of Rust Survey, up from 38.7% in 2023. Rust AI agent repositories on GitHub went from 25 stars per day in 2023 to 404 per day in 2026 — a 16x increase. The agent infrastructure community has already voted.
Language Choice Now Has an AI Toolchain Dimension
The Zig-versus-Rust debate used to be about language ergonomics, build times, and ecosystem maturity. Those factors still matter. But a new dimension has entered the calculation: does your language work with agentic development workflows?
Zig’s anti-AI contribution policy is a principled position. It reflects a genuine belief about what makes open-source communities sustainable — valuing contributors over contributions, betting on people developing expertise rather than outsourcing their growth to a language model. That reasoning holds for a community project maintained by volunteers.
It does not hold for a commercial runtime that just got acquired by an AI company. And it will hold less and less for any project where AI coding agents are part of the standard development workflow. The developer who wrote the Zig vs Rust in 2026 comparison framed it plainly: the 100x productivity boost from coding agents outweighs Zig’s 1.5–5x human developer experience improvements. That is a hard argument to refute with build time benchmarks.
The Bottom Line
If you are building for embedded systems, writing firmware, or maintaining a project with significant C interoperability and a human-only contribution model, Zig is excellent at what it does. Nothing in the Bun story changes that.
If you are building production software where AI coding agents are part of your workflow — and that increasingly means any serious commercial project in 2026 — Rust’s type system is not just a safety feature. It is the interface between your compiler and your AI toolchain. The Bun rewrite made that concrete: one million lines, 11 days, 128 bugs eliminated at compile time.
The interesting follow-up question is what Zig’s AI ban means long-term for the project’s commercial adoption. It may keep the community healthy. It may also mean Zig becomes the language of principled open-source projects and custom runtimes — excellent in its niche, increasingly absent from commercial codebases. That outcome would be significant, just not the one Zig’s advocates are hoping for.













