Zig → Rust porting guide
Status of the Bun Zig→Rust Port
- The “claude/phase-a-port” branch adds ~750k LOC of Rust generated from Zig via Claude, guided by a detailed PORTING.md.
- A Bun maintainer says this is an experiment, not a committed rewrite: code does not work yet and may be discarded.
- Goal: see what a working Rust version would look like, how it performs, and how hard it is to make it pass Bun’s test suite and be maintainable.
Motivations Discussed for Considering Rust
- Zig is pre‑1.0 and changes frequently; large codebases like Bun face recurring breaking changes.
- Bun already maintains a Zig fork; long-term, that’s viewed as technical debt.
- Zig’s project refuses LLM-generated contributions; Bun/Anthropic rely heavily on AI coding, creating friction.
- Rust is seen as:
- More mature and stable.
- Better supported by LLMs and with more training data.
- Having a larger ecosystem and contributor pool.
- Better at catching bugs via its type system, which can help supervise AI output.
Zig Side: Rejected Patch and AI Policy
- Zig maintainers publicly argued Bun’s Zig fork changes were technically unsound and conflicted with ongoing compiler work; they say the PR would have been rejected even without AI.
- Some view Bun’s move as a reaction to Zig’s anti‑LLM policy; others see it as a rational response to not being able to upstream key changes.
- Debate over whether losing Bun is a “huge loss” for Zig or largely irrelevant to Zig’s trajectory.
AI / “Vibe Coding” Debate
- The port is largely AI-generated; single commits with tens of thousands of new lines raise reviewability concerns.
- Disagreement over the term “vibe coding”:
- Narrow definition: AI writes code that humans barely read; that’s criticized as reckless.
- Broader usage: any heavy AI assistance, including systematic ports with tests.
- Some report strong results from AI-assisted language-to-language ports (Postgres, TypeScript, etc.) when paired with thorough test suites.
- Others argue massive AI diffs are essentially unreviewable, risk regressions, and erode developers’ mental models of the system.
Risks, Concerns, and Reactions
- Many worry about a large-scale rewrite of a complex, “mature” system, especially via AI, as a classic high-risk move.
- Existing Bun issues (segfaults, memory bugs, leaks) are cited as evidence that quality is already fragile; some hope Rust will help, others fear compounding risk.
- Some users say they’ll avoid or migrate off Bun until the direction is clearer; others are excited to see this as a major public test of AI-assisted porting.