Loading...
Loading...
Bun’s maintainers have merged a large-scale rewrite that ports the JavaScript runtime from Zig to Rust, removing most .zig files and introducing Rust toolchain files, Cargo manifests, and new CI workflows. The rewrite reportedly completes in days for parts of the codebase and achieves ~99.8% test-suite parity on Linux x64, shrinking binaries, reducing memory bugs, and improving maintainability via Rust’s safety guarantees. Remaining .zig artifacts and some CI test failures surfaced during cleanup, prompting further fixes. The change signals a deliberate platform shift to Rust that could affect Bun’s stability, performance, and its positioning against Node and Deno.
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
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.
In six days, a developer rewrote Bun — the JavaScript runtime — in Rust, achieving 99.8% test-suite pass rate on Linux x64 glibc for a 960,000-line-of-code port. The author says the Rust rewrite preserves the original codebase logic while adding compiler-enforced lifetimes and predictable destructors, making memory-safety issues more visible (unsafe blocks) and encouraging refactors. The rewrite was partly automated and addresses stability, memory leaks, and crashes that plagued the prior implementation; a full blog post is promised with benchmarks, memory usage, maintainability analysis, and details of the porting process. The author also mentions plans around libc and comparisons to Zig toolchains.
In six days, a developer ported Bun — the JavaScript runtime — from its prior implementation into Rust, achieving 99.8% pass rate on Bun’s existing Linux x64 glibc test suite. The rewrite spans roughly 960,000 lines of code and preserves the original codebase’s structure while leveraging Rust’s ownership, lifetime checks and deterministic destructors to reduce memory leaks, crashes and stability work. The author says unsafe blocks highlight ugly areas for refactoring and promises a forthcoming blog post with benchmarks, memory usage, maintainability analysis, and a technical account of the process. The post notes future work on libc and cross-platform support, and compares compile performance implications versus Zig. This could materially affect Bun’s reliability and developer maintenance burden.
oven-sh / bun Public Notifications You must be signed in to change notification settings Fork 4.4k Star 89.6k File tree Expand file tree Collapse file tree Open diff view settings Filter options docs PORTING.md scripts port-batch.ts Expand file tree Collapse file tree Open diff view settings 0 commit comments Comments 0 ( 0 )
Bun (the js runtime) is being vibe-ported from zig to rust
oven-sh / bun Public Notifications You must be signed in to change notification settings Fork 4.4k Star 89.6k File tree Expand file tree Collapse file tree Open diff view settings Filter options docs PORTING.md scripts port-batch.ts Expand file tree Collapse file tree Open diff view settings 0 commit comments Comments 0 ( 0 )
oven-sh / bun Public Notifications You must be signed in to change notification settings Fork 4.4k Star 89.6k File tree Expand file tree Collapse file tree Open diff view settings Filter options docs PORTING.md scripts port-batch.ts Expand file tree Collapse file tree Open diff view settings 0 commit comments Comments 0 ( 0 )