Re:Weird Expressions in Rust
by steveklabnik on Friday June 27, 2025 @01:57PM
(#44398854)
It is an aspect, but it Rust does not promise your core is secure.
It’s not purely expression based but it is very close to it, there’s only a few kinds of statements, the vast majority of things are expressions.
We would need an example of puzzling code that can easily hide (security) bugs.
The submission shows weird program snippets. I don’t think it shows weird snippets that can also easily hide bugs?
I think you're looking at it a little backward. Or rather, with superset/subset confusion. Rust can say "we care about memory safety" without being security-focused. But Rust cannot say "we are security-focused" without also caring about memory safety.
Being security-focused requires you to care about a laundry list of things, including memory safety. But on its own, caring about memory safety just means... you care about memory safety.
Rust is not written as a pure expression based language. And as we all know very well from the experience with C and JS, any unexpected and weird looking code has the potential to hide great harm. Allowing programmers to stray too much from expected idioms is dangerous.