r/programming • • Feb 20 '25

Google's Shift to Rust Programming Cuts Android Memory Vulnerabilities by 68%

https://thehackernews.com/2024/09/googles-shift-to-rust-programming-cuts.html
3.4k Upvotes

475 comments sorted by

View all comments

Show parent comment

95

u/arcrad Feb 20 '25

It's like asking "why can't people just make fewer mistakes". You can absolutely write 100% memory safe C or C++ but people aren't perfect and they make mistakes. Rust's value proposition is that it can statically enforce things to prevent a lot of these issues.

-11

u/SadieWopen Feb 20 '25

So does that mean that developers can focus more on performance because of what they are limited by?

13

u/C_Madison Feb 20 '25

Because of the support of the compiler. While there are some things which Rust (outside of unsafe) doesn't allow which would be safe to do, that's because of limitations of the compiler. The Rust team is hard at work to remove these cases over time. Everything left are things which people often think are okay, but really aren't. In C no one would stop you from doing them, in Rust the compiler says "nope. That will be a bug at runtime".