Why Is Everything Being Rewritten in Rust? AI Changed the Math, Not the Reason.
Bun ported 535k lines of Zig to Rust in 11 days with Claude. Memory safety was the reason. AI made it affordable.
Kemal EsensoyĀ·Modified on October 26, 2026
My website builds run on Rust, and I have never written a line of it.
When I upgraded QuietClip's site from Astro 6 to 7 this summer, the production build dropped from 4.95 seconds to 2.95 seconds. Most of that came from two places: Vite 8's new Rust bundler and Astro's new Rust template compiler. I changed a version number. Somebody else did the rewriting.
Then in July, Bun published a post saying one engineer had ported 535,496 lines of Zig to Rust in 11 days, with AI agents doing the typing. Google started converting C libraries with Gemini. Two separate teams pointed agents at the TypeScript compiler and got Rust ports out the other end. If you read tech news at all, it feels like every company on earth is rewriting in Rust at the same time.
I went through the primary sources to figure out why companies rewrite in Rust now, and the answer is less exciting than the headlines and more interesting than the memes. Memory safety is still the reason. AI changed the price.
Why Rewrite in Rust? The Old Answer Was Memory Safety
In 2025, memory-safety bugs dropped below 20% of all Android vulnerabilities for the first time. Google's numbers for its Rust code are hard to argue with: roughly 1000x lower memory-safety vulnerability density than its C and C++. Rust changes also got rolled back 4x less often and spent 25% less time in code review.
That's the argument Rust people have been making for ten years. C and C++ let you free memory and keep using it, or free it twice. Those mistakes are where a large share of serious security holes come from, and Rust's compiler refuses to build code that makes most of them.
Governments bought it before the AI wave. In June 2025, CISA and the NSA published a joint guide on memory-safe languages that recommends incremental adoption instead of big-bang rewrites. In December 2025, the Linux kernel maintainers declared the Rust experiment a success, and the Android Binder driver went in for kernel 6.18.
None of that needed an AI agent. The "why Rust" part of the story was settled years ago.
The Rewrites That Happened Before AI Could Do Them
Dropbox spent roughly four years rewriting its sync engine, Nucleus, in Rust. It shipped in March 2020.
Discord moved its Read States service from Go to Rust in February 2020 because Go's garbage collector was causing latency spikes. Cloudflare replaced Nginx with Pingora, its own Rust proxy, in 2022. It handles over a trillion requests a day on about a third of the CPU and memory the old setup needed. The Fish shell finished its port in February 2025, with 2,731 commits from more than 200 people. OpenAI rewrote Codex CLI in Rust in June 2025, partly to drop the Node.js install requirement and get better sandboxing. Ubuntu 25.10 shipped Rust versions of coreutils and sudo.
Look at the dates and the head counts. When you picture "everyone rewriting in Rust", most of what you're picturing was humans, over years, before coding agents could handle a codebase that size.
So the wave is real, but it's older than it looks. What changed this year is how fast a rewrite can go.
What Changed in 2026: Rewrites Got Cheap
Bun's own estimate for porting its runtime by hand was about a year for three engineers. The actual port ran from May 3 to May 14, 2026.
One engineer drove it with Fable and Claude Code, running about 50 workflows and up to roughly 64 Claude instances at once. That covered 535,496 lines of Zig across 1,448 files. The full test suite passes on every platform with nothing skipped, 60,624 tests on Debian alone. Bun put the API bill at around $165,000. I wrote about staying on Opus 4.6 until Fable 5 showed up, so I've watched this model do focused, grinding work up close. Not at anything near that scale.
$165k sounds like a lot until you compare it with three senior engineers for a year.
Google ported giflib, about 3,000 lines of C, with a single Gemini pass. Humans then fixed the C interface, and the result went through six days of fuzzing against more than 30 million real GIFs. It runs as fast as the C version. Google's own summary says AI translation is "not a hands-off panacea", which is a sentence I wish more vendors would print.
The TypeScript compiler got ported twice. Theo Browne got a Rust version for about $24,000 on Opus 5.5, after an earlier attempt burned through more than $400k of OpenAI tokens and stalled around 84%. On October 20, Cloudflare announced tsrs, another agent-written Rust port, claiming up to 8x faster type checking than TypeScript 7.
Microsoft is the cautionary footnote. In December 2025, Galen Hunt, a senior Microsoft engineer, posted a goal to eliminate every line of C and C++ from Microsoft by 2030, with a North Star of "1 engineer, 1 month, 1 million lines of code." Within days came the clarification: Windows is not being rewritten in Rust with AI, it's a research project.
Notice who reports most of these numbers. Bun's come from Bun, which Anthropic bought in December 2025, and Anthropic makes the tool I use every working day. Browne's and Cloudflare's come from Browne and Cloudflare. I have no reason to think anyone made anything up, but nobody independent has reproduced these results yet.
Why Rust Specifically: The Compiler Is the Reviewer
Jarred Sumner put it in one line in the Bun post: "Compiler errors are a better feedback loop than a style guide."
The workflow, as Pragmatic Engineer described it: for each crate, run cargo check, group the errors by file, have an agent fix them, then send the result through two adversarial reviewer agents and one fixer. Repeat until it compiles. A roughly 600-line PORTING.md told the agents how to translate Zig patterns into Rust.
That's why Rust and AI fit together so well. An agent writing JavaScript can produce code that runs and is quietly wrong. An agent writing Rust gets told no, specifically, at compile time, about a whole class of mistakes. A use-after-free stops being a production incident and becomes a red line in the terminal that the agent has to deal with before it moves on. Mitchell Hashimoto said Fable is "most excellent at hard, focused tasks with clear reward functions." A Rust compiler is about as clear a reward function as software has.
The evidence for this is thinner than the quote makes it sound. One preprint shows that a single round of compiler feedback raises compile and fuzzing success in C-to-Rust translation. Nobody has compared AI ports into Rust against AI ports into Go or Zig. So "the compiler is the reviewer" is plausible, and the people who did the Bun port believe it, but it isn't proven.
The TypeScript story has a twist, too. When Microsoft ported its compiler for TypeScript 7, the team picked Go, not Rust. Anders Hejlsberg's reasons were garbage collection and a programming model close to TypeScript's own, which matters in a codebase full of cyclic data structures. TS 7 shipped with 8-12x faster builds. Then agents ported it to Rust anyway, twice. Humans picked Go because Rust was awkward for that codebase. The agents don't seem to mind awkward as much.
The Part the Headlines Skip
About 4% of Bun's new Rust code sits inside unsafe blocks. That's roughly 13,000 unsafe keywords, the spots where Rust's compiler steps back and trusts the programmer. Bun says 78% of those blocks are a single line, which is fair context. It's still a lot of code where the memory-safety guarantee is switched off.
The port also introduced 19 known regressions (all fixed since) while fixing 128 existing bugs. If you've read my post about how Claude is great at building software and also great at breaking it, 19 is the number I'd expect, not a scandal.
Andrew Kelley, who created Zig, wrote a long response. His technical points: the speed gains mostly came from link-time optimization, which Zig always supported. The smaller binary had nothing to do with the rewrite. Bun published no compile-time numbers. A passing test suite doesn't prove the test suite is good enough. And roughly a million lines shipped without a human reading them. That last one is the point I can't shake, because it's exactly the problem I wrote about in the AI code nobody understands is piling up.
The skeptics have history on their side as well. JetBrains published a rewriting-in-Rust reality check in August 2026 that doesn't mention AI once. It lists rewrites that failed or stalled, Prisma and curl's hyper backend among them, and puts a medium codebase at 1-2 years and a large one at 2-5. Human-written Rust has bugs too: Ubuntu's Rust date broke automatic updates, and sudo-rs shipped a password-echo CVE. Rust stops memory bugs. It doesn't stop wrong logic.
And "everyone" is an exaggeration. A GitHub list that tracks AI-assisted Rust rewrites has six entries.
What This Means If You Run a Normal Web Shop
You probably won't write Rust. I don't. You're likely running it already.
Vite 8 replaced esbuild and Rollup with Rolldown, a Rust bundler, in March, and Next.js 16 made the Rust-based Turbopack its default. Astro 7 moved its own compiler from Go to Rust. On my Astro 6 to 7 upgrade, the Vite bundle step went from 2.66 seconds to 0.92. That's the Rust rewrite wave as most web developers will meet it: a changelog line and a faster deploy.
The part that will actually reach you is the pitch. Somebody reads about Bun and decides your legacy PHP app, or your client's eight-year-old monolith, should be rewritten over a long weekend. Patrick Koss has a line I keep coming back to: "AI made rewrites cheap. It did not make owning code cheap."
Bun was open about what made its port possible. I'd use that as the checklist for any rewrite pitch, Rust or not, plus one item of my own:
- An owner who knows the codebase deeply and actually wants the rewrite
- An extremely thorough test suite that defines what "still works" means
- A token budget that can absorb a failed first attempt
- Someone who will still be around to maintain the result a year later
When I moved three client sites from WordPress to Astro with Claude, it took about three weeks instead of the two to three months I'd estimated, and most of that time went into reviewing and testing pages. That works for marketing sites where you can look at every page yourself. It does not scale to 535,000 lines, and I won't pretend it does. The bigger the rewrite, the more of the work moves from writing code to proving the new code behaves like the old code.
So, Is It Memory Safety or AI?
Both, doing different jobs. If someone asks you why rewrite in Rust in 2026, the short answer is: memory safety is why Rust, AI is why now.
The companies rewriting in Rust this year mostly had the reason years ago and couldn't justify the cost. An AI-driven port turned a three-engineer year into eleven days and a six-figure invoice, and Rust's strict compiler gives the agents something to argue with until the code is right.
What I don't know is how this code ages. Nobody has twelve months of data on maintaining a million lines of AI-ported Rust that no human read line by line. I'm not sure Bun knows either. Ask me again next October.
If you're looking at a rewrite pitch for your own app and can't tell whether it's a smart move or an expensive hobby, let's talk. I won't sell you a rewrite. I'll help you check whether you have the tests and the reason before you spend the money.
Find these posts useful? Mark Wunderlandmedia as a preferred source on Google ā my articles will then show up more often in your Search results, AI Overviews and AI Mode.
Set as preferred sourceAbout the Author
Kemal Esensoy
Kemal Esensoy, founder of Wunderlandmedia, started his journey as a freelance web developer and designer. He conducted web design courses with over 3,000 students. Today, he leads an award-winning full-stack agency specializing in web development, SEO, and digital marketing.