Migrating large C/C++ codebases to Rust is a growing priority driven by memory safety concerns and government mandates, but two popular approaches — full stop-the-world rewrites and AI-powered auto-translation — are both deeply flawed. AI tools degrade sharply on large tasks, and automated translators like c2rust produce non-idiomatic Rust riddled with unsafe blocks. The practical path forward involves: improving existing C++ with safer patterns first, decomposing spaghetti code into well-defined components using the Strangler Fig pattern, then incrementally replacing subsystems with idiomatic Rust one at a time. Interop tools like cxx help bridge the gap during transition. The key insight is that translation is not the hard part — re-architecting programs around Rust's ownership model is, and that work cannot be shortcut.

10m read timeFrom bitfieldconsulting.com
Post cover image
Table of contents
Some things that won’t workThings that might work
285.6K Impressions8 Comments