$13.5 million in API costs. That's the estimated price tag for asking Claude to translate the entire Linux kernel - all 36 million lines - from C to Rust. And that's before a single human reviews the output.
A developer spent a weekend testing this idea against real kernel modules of increasing complexity, and the results are more nuanced than "it works" or "it doesn't."
The Three-Module Test
The experiment targeted three actual Linux kernel modules:
- Simple character device (~150 lines of C to ~180 lines of Rust): Claude produced a clean translation using the kernel crate's existing abstractions. Essentially a pass.
- Network driver (~2,400 lines to ~3,100 lines): The structure was sound, but Claude struggled with DMA buffer lifetime invariants - the rules governing when memory allocations are valid and who owns them.
- Filesystem module (~4,800 lines to ~5,600 lines): Data structures translated accurately, but the VFS (virtual filesystem) integration was riddled with lifetime annotation errors. Lifetime annotations are Rust's way of tracking how long references remain valid, and getting them wrong means the code won't compile.
The pattern is clear: modules under roughly 5,000 lines with well-defined API boundaries produce usable output. Anything larger or more tightly coupled breaks down.
Where Syntax Ends and Meaning Begins
The core finding is that Claude translates syntax well but can't encode what the developer calls "invariants" - the unwritten safety contracts that C programmers enforce through convention and discipline. In Rust, those contracts need to be expressed through the type system. Claude doesn't understand the intent behind the code well enough to make that leap consistently.
Other blockers include roughly 50,000 lines of inline assembly requiring architecture-specialist review, macro-heavy code that embeds safety logic in preprocessor directives, and RCU concurrency patterns (a Linux-specific technique for lock-free data sharing) that have no clean Rust equivalent.
60% of the Kernel Could Still Benefit
The interesting takeaway isn't that Claude can't do the whole job - nobody expected it could. It's that bounded modules representing over 60% of the kernel codebase, primarily hardware drivers, could be meaningfully accelerated by AI translation with human review on top.
The economics tell the real story. Even if the $13.5 million API cost were acceptable, you'd still need thousands of hours of expert review afterward. But for individual driver teams already planning Rust rewrites, using Claude to generate a first draft and then fixing the invariant issues manually could cut the mechanical work substantially.
The developer's summary captures it well: Claude translates the code, but a human is still needed to translate the invariants. That distinction - between moving syntax from one language to another and actually understanding what the code means - remains the boundary where AI coding tools add value versus where they create false confidence.