Bun’s core codebase has been rewritten from Zig to Rust, passing all pre-existing tests across platforms while shrinking binary size by 3-8 MB.
Key Takeaways
The rewrite fixes multiple memory leaks and flaky tests; compiler-assisted memory safety now catches use-after-free, double-free, and forgot-to-free-on-error-path bugs at compile time.
Binary size drops 3-8 MB and benchmarks are neutral to faster; no async Rust was used.
Architecture and data structures are unchanged; Bun still uses few third-party libraries.
The Rust canary build is available now via bun upgrade --canary; non-canary release pending further optimization and cleanup PRs.
Rust memory safety does not cover leaks from long-held references or re-entrant calls across the JS boundary, per Jarred.
Hacker News Comment Review
The rewrite is LLM-assisted at massive scale: +1,009,257 lines of Rust added, with a 622-line Zig-to-Rust mapping document prepared upfront to guide model output consistency.
Code quality skepticism is high: 10,428 unsafe {} blocks across 736 files were counted in the merged code, and reviewers question whether any human review occurred at this scale.
Jarred had publicly called an earlier thread “an overreaction” and said the branch would likely be scrapped; the fast reversal drew pointed criticism about credibility and ownership dynamics.
Notable Comments
@sesm: Pre-prepared Zig-to-Rust idiom mapping file and internal smart pointer types that map 1-to-1 to Rust equivalents show the codebase was deliberately primed for LLM translation.
@gm678: Raw counts show 929K lines of Rust alongside 711K lines of Zig still in the repo, plus 10,428 unsafe blocks.
@xiphias2: Some failing tests were fixed by modifying the tests themselves, raising concerns about real-world compatibility for already-deployed programs.