January 5, 2026
Segfaults need seatbelts
Building a Rust-Style Static Analyzer for C++ with AI
Dev brings Rust-style safety to C++ with AI; fans cheer, skeptics demand receipts
TLDR: An open-source tool aims to give C++ Rust-like memory safety without a rewrite, using AI. Commenters split between “finally!” and “show me on real code,” while others argue Rust–C++ interop is coming and derail into AI model wars.
Months of chasing ghost bugs in C++ pushed one professor to try a bold fix: bring Rust’s borrow checker vibes to C++ without a rewrite. His open-source project rusty-cpp aims to be a static analyzer—basically, a code scanner that catches memory mistakes before they crash your app. No experimental compiler, no new language; just rules about who owns data and when it can be used, like Rust. Circle C++ looked promising but was closed-source, grammar-changing, and stalled, so he’s going the DIY route with AI.
The comments turned into a popcorn fest. hu3 crowned it a “quick win” for countless codebases, while jjmarr demanded a demo on a real, medium-sized project. MeetingsBrowser challenged the premise entirely, saying Rust–C++ interop is actually a top priority backed by funding—sparking a debate: build tools now or wait for official bridges. Then the thread swerved into AI model drama: minimaxir insisted “Opus 4.5” is miles ahead of “Sonnet 4.5,” and dash2 asked if AI-written code is even readable. Jokes flew about “seatbelts for C++,” “borrow police,” and “segfault exorcism.” The vibe? Half the crowd yelling finally, safety without a rewrite, the other half clutching clipboards and asking for receipts—with a side quest into model fan politics.
Key Points
- •The author seeks Rust-like memory safety for C++ to prevent issues such as memory leaks, dangling pointers, and use-after-free.
- •Seamless Rust/C++ interop is deemed unlikely soon, making direct adoption of Rust impractical for existing C++ codebases.
- •A macro-based borrow-tracking approach in C++ was found infeasible based on prior analysis by Google engineers.
- •Circle C++ offers Rust-style borrow checking but is impractical due to reliance on a closed-source compiler, grammar changes, and rejection by the C++ committee.
- •The proposed solution is a dedicated static analyzer that traverses the C++ AST, primarily performing single-file, statically scoped analysis, though it requires significant engineering.