All posts
toolingruntime

Bun Moved From Zig to Rust, and My Lockfile Didn't Notice

Half a million lines ported in days, a stable 1.4 release, and a loud argument about it. What actually changed for people who just use Bun, and the lesson worth keeping.

Muhamad Choirul Adam 4 min readPhoto: Unsplash

I use Bun every day, mostly as a package manager and script runner. This site runs on it. So when the news broke in May that Bun had been ported from Zig to Rust, my first question wasn't about languages. It was: do I need to change anything?

The answer, after upgrading to Bun 1.4 when it went stable on August 20: no. bun install still installs. bun run dev still runs. That's the most impressive part of the whole story, and the least discussed.

What happened

Bun was written in Zig from the start. In 2026, the team ported roughly 535,000 lines of it to Rust, using a large number of Claude agents working in parallel. Accounts of how long it took vary from about a week to a couple of weeks for the main port, with months of cleanup around it. The Rust version was merged into the main branch in mid-May. The last Zig-based release was 1.3.14, and 1.4 is the first stable release on the Rust codebase.

Rendering diagram…

Why move at all

Jarred Sumner's explanation was about memory, not fashion. Bun lives in two worlds at once: JavaScript objects managed by a garbage collector, and native memory the runtime manages itself. Getting the boundary between the two right, everywhere, is where many of Bun's crashes and leaks came from. His argument was that Zig wasn't designed for that particular mix, and Rust's ownership model gives you more help at exactly that boundary.

Reports since the move mention a long list of memory leaks fixed along the way. Whether that's the language, the fresh look at old code, or both is hard to separate.

Why it worked: the test suite

Here's the part I keep coming back to. Bun has an enormous test suite, more than a million assertions. The port was checked against it the whole way.

That's what made a rewrite this fast possible at all. The tests were the specification. Without them, "it compiles" would have been the only signal, and for a runtime that half the JavaScript ecosystem now depends on, that's not a signal.

Why people are still arguing

The criticism is fair and worth reading, not dismissing:

  • Tests only catch what they test. The team reported 19 subtle behavior changes from the mechanical port, cases where Zig and Rust code that looks the same does something different. They were found and fixed. The worry is about the ones that weren't.
  • unsafe everywhere. A direct port from Zig produces a lot of unsafe Rust, which gives up much of the safety that was the reason to switch. Cleaning that up takes years of careful human work, not days.
  • Review at that scale. Andrew Kelley, who created Zig, asked the obvious question: if the tests missed bugs in the Zig code, what catches them in Rust code nobody read line by line?

None of this means the port was a mistake. It means "done" for a rewrite like this is a long way past "merged".

What I'm taking from it

Not "rewrite everything in Rust," and not "let agents port your codebase." The lesson is older and more boring than either:

The test suite is the asset. Bun could change the language under half a million lines because the behavior was pinned down by tests. Most codebases couldn't survive a much smaller refactor, not because of the language, but because nothing describes what the code is supposed to do.

If you take one thing from this, take that. Write the tests that would let you change your mind later.

As for me: I'm on 1.4, my lockfile didn't change, and my scripts didn't notice. For a tool, that's the highest compliment I can give.