News

Bun completes Rust migration, signaling a major win for memory safety

Bun's Rust rewrite is still in canary form, but its 13,365 unsafe blocks and giant PR already show why the runtime is betting on a harder, safer path.

Jamie Taylor··2 min read
Published
Listen to this article0:00 min
Bun completes Rust migration, signaling a major win for memory safety
Source: bun.sh

Bun’s move to Rust reads less like a language vanity play than a hard engineering decision with real operational cost. The runtime’s rewrite has become a live debate inside the Rust and JavaScript tooling communities because it sits at the intersection of memory safety, contributor ergonomics, and the kind of maintenance burden that eventually pushes fast-moving infrastructure projects toward a different foundation.

Bun says the Rust port has not shipped in a released build yet, and the version developers install today still runs the original Zig implementation. The new code path is being treated as a pre-release, canary track while optimization and cleanup continue. Bun’s own audit, published on May 21, 2026, put the scale of the work in stark terms: 13,365 unsafe blocks in the unreleased Rust port, with most of them reportedly removable. That number matters because it shows the rewrite is not a cosmetic port. It is a deep rebuild that still needs hardening before it can become the runtime’s default path.

AI-generated illustration
AI-generated illustration

The migration is visible in GitHub as PR #30412, titled “Rewrite Bun in Rust,” a marker of just how far the codebase has moved from a small refactor. A follow-up PR, #30746, updates Bun’s runtime description from Zig to Rust, a detail change that still reflects a bigger identity shift in the project. Workflow activity in the oven-sh/bun repository also shows the rewrite running as an active branch of work, not a side experiment.

What makes the change especially notable is Bun’s position inside Anthropic and its use in Claude Code. That raises the stakes beyond a typical runtime rewrite. For a system with that kind of footprint, Rust offers a more conventional path for memory safety, easier onboarding for contributors already fluent in Rust tooling, and an ecosystem that can absorb more of the low-level work without relying on a smaller language community. It also suggests Bun is weighing the tradeoff many infrastructure teams eventually face: accept a painful rewrite now, or keep paying the long-term tax of bespoke unsafe code.

The transition has also drawn pushback. GitHub issues around the rewrite have centered on unsafe Rust, undefined behavior, and whether AI-assisted code generation belongs in a foundational runtime at all. One discussion explicitly questioned whether the codebase should even be trusted as Rust given the safety concerns. That tension is the real story here. Bun is not just changing languages. It is testing how much rewrite cost a modern runtime should absorb to get to a safer, more maintainable future.

This article was produced by Prism’s automated news system from verified source data, official records, and press releases, then run through automated quality and moderation checks before publishing. The system is built and supervised by the people who set the standards it runs under. Read our full AI policy.

Know something we missed? Have a correction or additional information?

Submit a Tip

Never miss a story.

Get Rust Programming updates weekly. The top stories delivered to your inbox.

Free forever · Unsubscribe anytime

Discussion

More Rust Programming News