3 min Devops

Bun takes a surprising step from Zig to Rust

Bun takes a surprising step from Zig to Rust

The developers of the JavaScript runtime Bun have decided to largely rewrite the platform in Rust. In doing so, the project is moving away from Zig, the programming language that made Bun famous in the first place. The switch is drawing extra attention because Bun has been part of Anthropic since last December and plays a role within Claude Code.

The change became apparent through a massive pull request on GitHub. According to tech site Heise.de, it involves approximately 2,188 modified files and nearly one million rewritten lines of code. Only a few thousand lines are said to have been removed. This makes the operation one of the largest AI-related code conversions to have become publicly visible.

According to Bun founder Jarred Sumner, the existing architecture will largely remain intact, but Rust offers better tools for detecting memory and stability issues early on.

It is striking that as recently as May 5, Sumner downplayed speculation about a switch to Rust. In discussions on Hacker News, he called the commotion exaggerated and suggested that the new code might never become part of Bun.

From Zig flagship to Rust project

Since its introduction, Bun has been considered one of the best-known software projects heavily reliant on Zig. The switch to Rust is therefore seen by many developers as more than just a technical choice. A discussion is emerging within the open-source community about Anthropic’s influence on the project’s future direction.

Anthropic previously announced that it had acquired Bun as part of the infrastructure behind Claude Code. According to the AI company, that development environment achieved an annual revenue run rate of approximately $1 billion within a few months.

Heise.de reports that the migration was largely carried out using Claude Code. This creates a striking scenario in which an AI coding platform is helping to rewrite the infrastructure on which it runs.

At the same time, the operation is sparking heated debate among developers. Critics point out that some tests have been modified so that the Rust version passes them successfully. Additionally, GitHub issues are reportedly appearing with errors that did not occur in the original Zig version.

According to Sumner, the migration is primarily about maintainability. The developers report that the existing tests now pass on all supported platforms and that multiple memory leaks and unstable tests have been resolved.

AI writes infrastructure software

The discussion surrounding Bun now extends beyond the choice between Zig and Rust. On Hacker News and Reddit, developers are openly speculating about the extent to which AI tools can independently migrate and maintain complex infrastructure software.

As a result, Bun seems to be increasingly turning into a real-world test case for AI-assisted software development at the infrastructure level. It is striking that it remains unclear how many tokens, how much computing power, and what development costs were involved in the migration. It is precisely this aspect that may determine whether such large-scale AI porting becomes feasible outside of major AI companies as well.