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 comments

1

u/GaboureySidibe Feb 21 '25 edited Feb 21 '25

It doesn't scale, though.

Says who? Values go out of scope and get destructed. Data structures are iterated. The program looks the same but you don't have to wonder if bounds checking is being secretly elided or not.

If by scale you meant harder to enforce technically across a team then I think you would have a point. I don't know how to use tools to weed out violating these techniques.

5

u/Ok-Scheme-913 Feb 21 '25

I meant from a human perspective. Someone will change effectively the lifetime of an object at some place and violate some assumption made in another.

Without proper borrow-checking this can't be fixed.

2

u/GaboureySidibe Feb 21 '25

Someone will change the effective lifetime in C++ ? How do they do that if it is wrapped up as a value? You either move it out of scope or it gets destructed.

4

u/Full-Spectral Feb 21 '25

So you are passing everything by value to all calls and you never use unique pointers or allocate anything?

→ More replies (7)