YouTube Summaries

← All summaries

Rust Rewrites Got Cheap, Not Better

2026-08-10 Mon ⏱ 25 min fknight

Rust is over ten years old and nothing about it changed in 2026, yet Microsoft, Meta, Cloudflare and others all ported major systems to it in the past twelve months — including teams that had explicitly shelved the same rewrite five years earlier as too expensive. Forrest's thesis is twofold: AI collapsed the cost of a port, and Rust's compiler happens to be the best available verification loop for an autonomous agent, which makes it the disproportionate beneficiary.

Bun: Zig to Rust in 11 days

Bun had ~535k lines of Zig and a recurring class of bugs — use-after-free, memory leaks, race conditions — from sitting on top of the garbage-collected JavaScriptCore while managing memory manually in Zig. Jarred Sumner had already established that most of these would have been compile errors in Rust, but a hand port meant pulling three engineers off the product for roughly a year, so he settled for homegrown Rust-inspired smart pointers with worse ergonomics and none of the guarantees.

After Anthropic acquired Bun in December 2025, he ran the port as an experiment with the then-unreleased Fable 5. The raw port passed Bun's entire test suite before cleanup, fixed a pile of memory bugs and flaky tests, and came out smaller and faster. It cost $165,000 in API pricing over 11 days — against a Bun engineer salary of roughly $160k, times the three engineers and one year Jarred estimated. Forrest thinks that estimate was optimistic anyway: Dropbox's sync engine took six engineers four years (though it was a re-architecture, not a port), and TypeScript's port to Go took five to eight engineers about two years.

He adds the caveat that this is not a human-out-of-the-loop story, and interjects that if he could push AI off a cliff tomorrow he would — he is describing capability, not cheering it.

Meta: OCaml to Rust, and the choice that wasn't easy

Flow, Meta's type checker (React is written with it), was in OCaml — a good language for the job, but with few hirable engineers and a runtime that wasn't going to clear Meta's JS monorepo scaling walls. They considered the port in 2019 and shelved it on cost.

The interesting part is language choice. TypeScript picked Go partly because it was a straightforward port. Rust was the harder target from OCaml, since OCaml is garbage collected and Go or Kotlin share its mark-and-sweep model. Meta took the riskier Rust port anyway, to sit in the ecosystem where JS tooling is already going — SWC, Rolldown, Bun, Biome, Vite — for the integration surface. Result: roughly 2x general speedup, up to 100% faster on heavy workloads.

Unlike Bun, it did not just work. The first full Rust build passed zero tests, and once it ran it was slower than the OCaml version until humans fixed the allocation patterns. AI did the grunt work; humans refined. Meta's Rust adoption is broader than Flow — the React compiler was ported from TypeScript (also starting as an experiment), and decades-old C in a core messaging library behind Messenger, Facebook and Instagram is being rewritten.

Forrest's favourite detail: the first Rust compiler was written in OCaml, so Rust is now replacing its own parent language.

You can get Rust's benefits without writing Rust

Linear swapped Vite 8's bundler for Rolldown and production builds went from 46 seconds to 6. The same dependency upgrade cut Ramp's build times 57%, Mercedes-Benz's up to 38%, Beehiiv's 64%. Choose dependencies wisely.

Updates on older rewrites

  • Linux kernel — last year's drama (a maintainer calling Rust "a cancer", resignations) resolved at the December maintainers summit: the Rust experiment is concluded and Rust is officially here to stay. At Rust Week, Greg Kroah-Hartman demoed a new untrusted type he claims could eliminate 80% of kernel CVEs.
  • Microsoft — from font rendering last year to Rust running inside the Windows kernel.
  • Cloudflare — the nginx-based core proxy that fronted a large chunk of the web for a decade replaced by FL2 in Rust; sites got ~10ms faster at the median.

The AI labs are standardising on Rust

This matters because a lab's language of choice likely gets prioritised in training. OpenAI rewrote the Codex CLI from TypeScript to Rust and acquired Astral (uv, Ruff — Python tooling built in Rust), which Forrest reads as partly an acquihire, since Astral's Rust engineers moved into the Codex org. SpaceX AI open-sourced its Grok build CLI written in Rust from scratch rather than ported — a good product, he argues, despite complaints about AI-written slop, though the version that silently packaged your repo and uploaded it to their cloud bucket was indefensible (since backtracked, allegedly deleted). X also replaced its Scala/Java algorithm with Rust: orchestration layer, post store and serving pipeline in Rust, tying together the Grok-based ranking model called Phoenix.

Why Rust and AI fit

When Bun's port hit ~16,000 compiler errors, they pointed 64 Claude agents at cargo check overnight, fixing files autonomously. The compiler, not a human, was the reviewer in the loop — and Rust's compiler catches more classes of mistake than any other Forrest has used. That is the mechanism behind the trend.

The caveat

Rust is not a magic bullet. Mitchell Hashimoto evaluated it for Ghostty and chose Zig: he finds Rust too complex and simply doesn't enjoy writing it, which he freely calls a stylistic choice. There are technical reasons too — Zig's C interop is excellent, whereas Bun's C/C++ boundary is FFI with unsafe blocks and left the codebase with ~4,000 permanent unsafe blocks. Mitchell also prefers explicit memory management over negotiating with the borrow checker, and some developers pick Go purely to avoid compile waits.

Takeaway

Rust isn't what changed in 2026 — the cost of switching to Rust is. Forrest closes on an open question he may cover separately: much of the internet's plumbing being rewritten in Rust (sudo, coreutils) is unowned and unprofitable, so who is funding those rewrites? Partly big tech, partly government pressure short of an Ada-style mandate.