Agents barely feel the costs that kept teams off Rust. The bugs that got through still compiled, and catching them is your test suite’s job.
GitHub’s agents hit 8,678 compiler errors while porting the Copilot runtime from TypeScript to Rust this year. Ownership, borrowing and lifetimes, the stuff that made a whole generation of developers rage-quit Rust in week two, caused 1.7% of them. The rest were wrong names, missing fields and mismatched types, the kind any typed compiler catches. Yes, an agent can buy a number like that with .clone(). I’ll get to it.
The port shipped 832,378 lines of production Rust.
What kept teams away from Rust was the cost of learning it, waiting on its compiler and fighting the borrow checker. Every one of those costs landed on a person, and agents barely feel them. What’s left is a compiler that rejects more programs than most and a linter you can lock down until the usual agent shortcuts fail CI.
So I think Rust is the best target for agent-written code right now. It still needs a referee, and the same port shows why. JavaScript’s || treats an empty string as missing. Rust’s unwrap_or treats it as a perfectly good value. Port one to the other and the behavior changes while the build stays green. GitHub caught that kind of bug because the old TypeScript runtime already defined correct. Build something new and you write that referee yourself, before you let an agent loose.
three ports, one referee
GitHub isn’t a one-off. Three big teams did this in 2026, and none of them did it for fun.
GitHub’s port took 128 pull requests and about 14.5 weeks, done „primarily by a single developer.“ The goal was a runtime that six SDK languages could embed without shipping Node. In GitHub’s benchmark, a batch of ten concurrent clients added 1,383 MB of memory on the old TypeScript runtime and 247 MB on the Rust one, or 126 MB in the opt-in embedded mode. GitHub was careful to say this „is in no way a claim that every large TypeScript program should become Rust,“ which is fair, and also the kind of sentence you write right after your benchmark table makes that claim for you.
Cloudflare and VoidZero announced tsrs on October 20, a Rust port of the TypeScript compiler that started life at Owner.com. The New Stack’s headline called it a port „written by agents, for agents.“ Cloudflare wanted a compiler that runs in WebAssembly, and its post contains my favorite sentence of the year: „frontier AI models can now do large-scale ports almost independently in a matter of days.“
Anthropic moved the Messages API, the API behind Claude, from Python to Rust. Claude wrote most of the code while the engineers designed the system, planned the migration and checked the output. Katelyn Lesse, who leads platform engineering, said on the Latent Space podcast that CPU usage dropped 40 to 50% and time to first token improved 10 to 20%. That comes from an interview, not a published report.
Different reasons, same move. Every one of them was also a port, so each team had an old system sitting next to the new one that already defined correct.
First, the obvious question. Why could these teams suddenly afford Rust at all?
rust’s costs were always billed to humans
Remember why people avoided it.
The learning curve was real. Synchronous Rust takes days to get comfortable with. Async, lifetimes and macros are a different league. That’s a big ask for a team with a roadmap to hit. An agent already has Rust in its training data, which goes a long way toward explaining how Anthropic’s team shipped its API in Rust after starting with no Rust developers at all. I suspect Rust’s youth helps too. There’s no mountain of 2009 forum answers in that training data, and a lot of public Rust was written by people who picked the language on purpose.
Compile times were the other classic complaint. You hit build, you go get coffee, you lose your train of thought. An agent doesn’t have a train of thought to lose. GitHub’s logs show 4,478 cargo check runs over the port, 87.1% of them clean, and not one of those runs broke anybody’s focus. You submit the task, do something else for a few hours and come back to a pull request. A slow compiler costs the agent some wall clock time and costs you nothing.
Then the borrow checker itself, the one that takes humans weeks or months before it stops feeling like a hostile coworker. For GitHub’s agents it was 1.7% of the errors. Here’s the clone problem I promised, though. GitHub’s log counts errors. It doesn’t say how each one got fixed, and an agent that answers a borrow error with .clone() never sees a second one. A low number can be earned, and it can also be bought.
Take those costs away and Rust’s strictness comes for free, and strictness is exactly what an agent needs.
the compiler writes the agent’s to-do list
Every rule a language enforces is a wall, and for an agent walls are good. Fewer valid programs means fewer ways to wander off to the left or the right on the way to the goal you gave it.
Rust’s compiler is the first validator you hand the agent, and it’s a chatty one. Say the agent adds a variant to an enum:
#[derive(Debug, PartialEq)]
enum PaymentState {
Pending,
Authorized,
Captured,
Refunded,
}
fn label(state: &PaymentState) -> &'static str {
match state {
PaymentState::Pending => "pending",
PaymentState::Authorized => "authorized",
PaymentState::Captured => "captured",
}
}
error[E0004]: non-exhaustive patterns: `&PaymentState::Refunded` not covered
Every match in the codebase that forgot Refunded shows up as an error with a file and a line number. Same story with traits. Add a method to a trait and every implementation breaks until someone writes it. For a human that’s a chore. For an agent it’s a to-do list the compiler wrote for free. In Python the same change is a KeyError waiting in production for the one customer who asks for a refund on a Sunday.
A to-do list only helps if the agent does the items instead of crossing them out, though.
close the escape hatches
Agents cheat. Not maliciously. They just want the red text to go away. Give one a borrow checker error and a deadline and you’ll get .clone() sprayed over every call site, .unwrap() on anything that returns a Result, a _ => arm that quietly swallows the new enum variant, and when all else fails, #[allow(...)] stapled to the function. It compiles. It’s also bad code.
Clone spray is the hard one. Clippy can flag some clones as redundant, but a .clone() that dodges a real borrow conflict is legal and often looks reasonable, so that one stays a review item. The other hatches you can weld shut. Clippy ships hundreds of lints, and you can turn on the strict ones in Cargo.toml:
[lints.rust]
unsafe_code = "forbid"
[lints.clippy]
pedantic = { level = "deny", priority = -1 }
unwrap_used = "deny"
expect_used = "deny"
panic = "deny"
todo = "deny"
wildcard_enum_match_arm = "deny"
allow_attributes = "deny"
too_many_lines = "deny"
cognitive_complexity = "deny"
And set thresholds in clippy.toml:
too-many-lines-threshold = 60
cognitive-complexity-threshold = 15
allow-unwrap-in-tests = true
Then run cargo clippy --all-targets -- -D warnings in CI and fail any change that touches the [lints] table, because the next thing a cornered agent does is edit the config. If Clippy’s list still doesn’t cover what your team cares about, Dylint lets you write your own lints.
Every rule in that file is one fewer thing you check by hand. Fair enough, but a strict Go setup gets you a lot of this too. So why Rust?
Go catches the same errors. It doesn’t build the same walls.
The GitHub author raises it directly, saying a C#, Java or Go compiler would have caught most of those 8,678 errors just as well. Microsoft’s own TypeScript port went to Go. That’s a fair hit, and I’d rather concede it than pretend otherwise. Name resolution and type mismatches aren’t a Rust superpower.
Where Rust pulls ahead is in what never shows up in an error log. There’s no null. Errors are values, and the type system makes you handle them. Every match has to be exhaustive, while a Go switch happily skips a case. Data races are compile errors in Rust, and in Go they’re something the race detector might catch at runtime if your tests happen to hit them. Each of those is one more wall around the agent.
There’s even a rough head-to-head. tsrs is benchmarked against TypeScript 7.0, which is Microsoft’s Go port, and reportedly follows the Go implementation’s algorithms closely. Cloudflare reports up to 8x faster with about 70% less memory. Independent runs came in lower, one at 2.7x against the TypeScript 7.1 beta, so treat the headline as a company number.
If your shop runs on Go, a strict golangci-lint config gets you a long way. Rust just leaves the agent fewer places to hide. It doesn’t stop the agent from writing the wrong program.
valid rust, wrong program
You know the saying. If it compiles, it’s probably correct.
GitHub’s port is the best evidence I’ve seen against it. Here’s the || problem from the top, as an illustration rather than GitHub’s actual code:
const name = input.name || "anonymous"; // "" becomes "anonymous"
let name = input.name.unwrap_or("anonymous"); // Some("") stays ""
Both lines look like the same idea. Both build. One of them just changed what your users see. Integers quietly became floats in the same port, and lifecycle bugs made up the biggest group of regressions. The post puts it bluntly: „The compiler accepted the buggy versions because, as far as the compiler was concerned, every one of them was valid Rust.“
What caught those bugs was the referee. Every existing end-to-end test ran against the new Rust code on every pull request, and if a required test failed, the change didn’t land. Review agents compared the old TypeScript and the new Rust line by line. Anthropic ran shadow traffic through the Python and Rust versions side by side before moving real users over. tsrs gets checked against TypeScript’s own conformance tests. The compiler made the agent’s mistakes smaller. The old system decided whether they were mistakes.
greenfield has no referee
New code comes with none of that. No old system to diff against, no shadow traffic, no conformance suite left over from the last rewrite. Even the 1.7% came from a port, where the agent had a working architecture to copy. Designing ownership from scratch is a different job, and I wouldn’t assume the number holds. If you want an agent to build something new while you sleep, you are the old system, and you write the referee before you hand off the task.
Back to the payment enum. The compiler forced every match to handle Refunded. It has no opinion on whether a payment that was never captured can be refunded. That rule lives in your head, so it has to live in a test:
#[test]
fn refund_requires_a_captured_payment() {
assert_eq!(refund(PaymentState::Authorized), Err(RefundError::NotCaptured));
assert_eq!(refund(PaymentState::Captured), Ok(PaymentState::Refunded));
}
An agent can write a refund that turns Pending straight into Refunded, and Rust will compile it without a word. This test won’t let it through. Write a few dozen of these for the rules that actually matter, and the agent has something to aim at besides a green build.
You still read what comes back. GitHub’s author said it outright: „Human judgment was still very heavily involved.“ But reading is a lot easier than writing, and you don’t need to understand lifetimes to notice that the billing module imports the HTTP layer. Skim the shape, check the domain model, read the money paths slowly.
Every success story this year borrowed its definition of correct from the system it replaced. On new code, nobody hands you one. For agents, the borrow checker turned out to be a rounding error, and your test suite is the bottleneck now.
Make the lints strict. Write the tests that define what correct means. Then submit the task and go to bed.