Bun is being ported from Zig to Rust

· coding · Source ↗

TLDR

  • The Bun team added a Phase-A porting guide to their repo, kicking off a structured Zig-to-Rust migration of the runtime codebase.

Key Takeaways

  • The commit 46d3bc2 adds docs/PORTING.md and scripts/port-batch.ts, establishing a formal, scripted process for the port.
  • The migration is structured as a file-for-file, line-for-line translation, not a redesign from scratch.
  • Bun has long run a fork of Zig rather than upstream Zig, adding maintenance burden that likely contributed to this decision.
  • The claude/phase-a-port branch shows the scale: 1,646 changed files, 773,950 additions, 151 deletions at time of posting.

Hacker News Comment Review

  • Commenters are split on whether AI-assisted mass rewriting is viable engineering or reckless: the file-for-file constraint gives some confidence that behavioral semantics are preserved, but others warn that institutional codebase knowledge is lost regardless.
  • The Zig angle matters: Bun was blocked from upstreaming improvements because Zig enforces a hard no-AI-code policy, giving the team both a practical and a political reason to leave.
  • Precedent cuts both ways – Go’s 2015 C-to-Go rewrite used a purpose-built conversion tool with manual cleanup; this port uses Claude at far larger scale, making quality assurance the open question.

Notable Comments

  • @archargelod: Points to the live claude/phase-a-port branch showing Claude actively rewriting Zig to Rust at 773,950 additions vs. 151 deletions.
  • @andkenneth: Confirms Zig maintainers blocked Bun from upstreaming a patch specifically because it contained AI-generated code.

Original | Discuss on HN