Loading...
Loading...
Bun’s core has been rapidly ported from Zig to Rust—reportedly in days using AI-assisted translation—merging a large Rust codebase that now passes most tests and trims binaries. The move aims to improve memory safety, maintainability, and tooling, but exposed mixed-quality generated code, CI hiccups, and public concern after leaked experiments and opaque communication. Users and companies warn of operational risks from a fast, partly automated rewrite: some production users are pausing Bun adoption over stability and governance worries. The episode spotlights trade-offs of AI-driven ports, the fluidity of language lock-in, and the need for clearer roadmaps and human review.
Bun migrating its core from Zig to Rust affects runtime maintainability, memory safety, and contributor workflows for a prominent JavaScript runtime. Tech teams using or building on Bun should reassess performance expectations, build tooling, and potential migration paths.
Dossier last updated: 2026-05-14 17:59:16
A payments startup has decided to stop using Bun as its primary runtime after two years, citing the project’s rapid and poorly communicated rewrite from Zig to Rust. The team had chosen Bun for fast startup, TypeScript ergonomics, and resource efficiency and ran Bun successfully in production across mission-critical services for 300+ companies. The sudden acceleration of the Rust migration introduced mixed implementations, transitional wrappers, and increased uncertainty about stability, timelines, and roadmaps—risks the company cannot accept for payments infrastructure where uptime and predictability are essential. They stress the choice isn’t about performance or mistrust, but about operational risk during an opaque large-scale rewrite.
Bun’s codebase—a high-performance JavaScript runtime originally written in Zig—was recently rewritten into Rust via an automated AI-driven translation that produced 6,755 commits merged within six days. The author argues Bun’s performance and architecture were shaped by Zig’s low-friction tooling and warns the Rust rewrite inherits Zig’s design assumptions; most critically, the translated code was generated and largely reviewed by AI (Claude and bots) with little human audit. Passing tests don’t guarantee correctness for error paths, concurrency, memory invariants or undocumented global constraints, so latent bugs could surface later. The piece frames this as both an engineering and governance risk now that the project is in a post-acquisition phase with different risk bearers.
Bun engineer Jarred Sumner ran a private experiment using an LLM to transpile Bun’s Zig codebase into Rust; the automatically generated Rust passed tests but produced low-quality, non-idiomatic code. The intention was a three-phase plan: produce a near-literal Rust translation to verify behavioral fidelity, then incrementally refactor toward idiomatic Rust, and finally complete a rewrite. The leaked branch and visible poor-quality output provoked strong reactions from Rust and Zig communities and worried users about AI-driven rewrites. The episode highlights how quick, low-cost AI experiments can validate technical possibilities but also spark public backlash if done transparently before refinement. It matters for projects weighing AI-assisted porting, rewrite risk, and communication strategy.
My Thoughts on Bun's Rust Rewrite
Bun 的 Rust 重写:一封来自 Zig 社区的公开信
bun 真的用 rust 重写了啊
@cat88tw: 哇!bun 只花 7 天就將上百萬行 zig 程式碼用 claude 改寫成 rust 版本而且神奇的全數通過測試,這代表幾件事:
Mitchell Hashimoto commented on May 14, 2026 that programming languages have become increasingly fungible, citing Bun’s recent port from Zig to Rust as evidence that language choice no longer creates permanent lock-in. He argued Bun demonstrated the ability to rewrite core projects in different languages quickly—weeks rather than months—making languages like Rust useful until they are replaceable. The observation highlights shifting trade-offs for developer tools and runtimes, implying faster iteration, fluid tech stacks, and reduced long-term dependency on particular languages for startups and platform teams.
Bun's Rust rewrite has been merged
Bun's Rust rewrite has been merged
Bun's Rust rewrite has been merged
Bun maintainers removed leftover .zig source files after completing a Zig-to-Rust port, pruning references and regenerating test fixtures to reflect the new codebase. The PR deletes most .zig files kept only as non-compiled references, while preserving a few required at build-time (DevServer.zig, bindgen siblings, and files referenced by $zig()/$newZigFunction() callsites). Tests and fixtures were updated—ban-limits.json was regenerated and a large-file test was pointed to parser.rs instead of deleted parser.zig. CI showed multiple failing tests across platforms (notably bunshell and fetch TCP keepalive tests), and reviewers flagged the PR as potentially AI-assisted. The change matters because it finalizes the language-port cleanup and reduces maintenance overhead and build noise for Bun's runtime and tooling.
Bun maintainers removed leftover .zig source files after completing a Zig-to-Rust port, pruning unneeded Zig references while keeping a small set required by the build pipeline. The change deletes most .zig files, updates test fixtures (ban-limits.json) and redirects a large-file test to parser.rs; a few .zig files remain because bake-codegen.ts, bindgen.ts, and generate-js2native.ts still reference them. The PR triggered CI failures in multiple Linux/macOS builds for bunshell and fetch keepalive tests, and maintainers provided local repro instructions. This matters because it finalizes a language migration, reduces repository clutter, and surfaces build/test gaps that must be resolved to ensure Bun’s runtime and tooling remain stable.
&#32; submitted by &#32; <a href="https://www.reddit.com/user/gruenistblau"> /u/gruenistblau </a> <br/> <span><a href="https://github.com/oven-sh/bun/pull/30412">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/programming/comments/1tcuebe/rewrite_bun_in_rust_has_been_merged/">[comments]</a></span>
Bun’s repository shows a large-scale migration: the project’s rewrite in Rust has been merged into the main codebase. The repository tree and workflows reveal extensive porting work, new Cargo configuration, Rust toolchain files, and many CI workflows and scripts for phased porting and testing. Key components—core server code, crates, and build tooling—now include Rust sources (main.rs and multiple Cargo.toml files) alongside previous Zig and C artifacts, indicating a deliberate language and architecture shift. This matters because Bun is a fast JavaScript runtime and bundler competing with Node and Deno; a Rust rewrite can improve safety, performance, maintainability, and ecosystem integration, affecting developers, performance benchmarks, and cloud/serverless use cases.
The Bun JavaScript runtime has merged a rewrite of its core implementation in Rust into the repository’s canary channel. The maintainers report the Rust version passes Bun’s existing test suite across platforms, reduces binary size by 3–8 MB, fixes memory leaks and flaky tests, and yields neutral-to-better benchmarks. Crucially, moving to Rust enables compiler-assisted detection and prevention of memory bugs, lowering debugging costs for the team. The architecture, data structures, and minimal third-party dependencies remain largely unchanged; the project does not adopt async Rust. Users can test the canary with bun upgrade --canary, while maintainers note further optimizations and cleanup are pending before a stable release.
Bun’s major rewrite in Rust has been merged into the repository, signaling a big engineering milestone for the JavaScript runtime. The commit shows extensive Rust-centric project structure: Cargo.toml files, a rust-toolchain, many workflows and porting tasks, and a new src/main.rs, indicating core components are being reimplemented in Rust. Key players are the Bun team and contributors managing CI, porting, and cross-language glue (Zig, TypeScript build scripts). Why it matters: rewriting Bun in Rust promises improved performance, safety, and easier maintenance compared with the prior C/C++/Zig mix, with implications for server-side JavaScript, developer tooling, and ecosystem compatibility. The merge suggests Bun is doubling down on Rust to compete with Node and Deno.
Bun v1.3.14 might be the last version in Zig
Bun v1.3.14 might be the last version in Zig
Bun’s complete rewrite from Zig to Rust now passes 99.8% of its existing test suite on Linux x64 glibc, according to developer updates. The project—an all-in-one JavaScript runtime and bundler—migrated core code to Rust to gain compiler-enforced lifetimes, deterministic destructors, and clearer boundaries around unsafe code, which the team says encourages safer refactoring. Achieving near-parity with the previous Zig implementation signals maturity of the rewrite and reduces the immediate risk of regressions for developers and users. This matters for server-side JavaScript tooling and runtime competition, as Bun’s performance and developer ergonomics improvements could influence adoption and ecosystem tooling choices.