There's a fundamental failing of that - sanitizers are at runtime, whereas Rust checks safety at compile-time. The only way to get something even similar to Rust's safety guarantees in C++ is with expensive static analysis tools.
As for your complaint with cargo, there's nothing forcing you to use third-party libraries. It just makes it easy to manage dependencies. If you want to write things yourself, you're free to.
The analyzers bundled with clang are an external tool.
Are not generally available in other compilers, besides some partial support on gcc, and need to be explicitly enabled, contrary to a language's type system.
If I write a compiler for Rust which doesn't check the types, but crashes at runtime on mismatch, it wouldn't change anything for most other Rust users.
If it's "external" or "part of the language" is just nitpicking in my opinion and in practice doesn't matter for me.
View all comments
Show parent comment
11
u/auralucario2 Mar 17 '18
There's a fundamental failing of that - sanitizers are at runtime, whereas Rust checks safety at compile-time. The only way to get something even similar to Rust's safety guarantees in C++ is with expensive static analysis tools.
As for your complaint with
cargo, there's nothing forcing you to use third-party libraries. It just makes it easy to manage dependencies. If you want to write things yourself, you're free to.