Bun is being rewritten from Zig into Rust, a major engineering change intended to reduce recurring memory-management failures without pausing development of the JavaScript runtime. Creator Jarred Sumner described the work as a largely mechanical port that retains Bun’s existing design, performance goals, features and TypeScript test suite.

The decision follows years of growth. Bun began in 2021 as Sumner’s Zig port of the transpiler from esbuild, and its command-line tools now record more than 22 million downloads each month. Services including Vercel, Railway and DigitalOcean provide first-party support, while developer tools such as Claude Code and OpenCode use Bun as a runtime. Bun was acquired by Anthropic in December 2025, and its team now works there.

Sumner emphasized that Zig itself was not responsible for Bun’s defects. Instead, he pointed to an awkward boundary between JavaScriptCore’s garbage-collected objects and memory that Bun manages manually. The code must account for JavaScript exceptions, ensure pointers remain visible to the garbage collector and free allocations exactly once. Errors in those rules have produced leaks and, less often, crashes. Around one-fifth of Bun is already C++, but the team concluded that C++ would still depend heavily on conventions, review and runtime tools to catch many ownership mistakes.

Rust’s ownership system, automatic cleanup through `Drop` and safe-language constraints can convert categories such as use-after-free, double-free and missed cleanup into compile-time errors. That gives developers feedback before fuzzing, continuous integration or sanitizer runs.

A traditional rewrite would have been difficult to justify: excluding comments, the existing implementation contains 535,496 lines of Zig, and Sumner estimated a small team would ordinarily require roughly a year. He instead tested a pre-release Claude Fable 5 model on the conversion. After several days, a large share of the existing tests passed and the generated Rust closely tracked the Zig implementation, persuading him to proceed.

The approach is a whole-system conversion rather than an incremental replacement. Sumner argued that a staged migration would introduce temporary bridging code and prolong architectural complexity. The language change therefore aims to minimize behavioral differences and relies on the language-independent TypeScript test suite as its compatibility check. The announcement presents compiler-enforced ownership as the central benefit, not a repudiation of the language that enabled Bun’s original rapid development.