Re:Turning off Rust's borrow checker, completely
by piaste on Tuesday January 23, 2024 @06:07AM
(#39101882)
The parent's point is that there is no separation between "before" or "after", it all ends up in the same artifact. And when you write invalid code, you have no guarantees about the compiled artifact anymore.
There is an example of C code (fairly sure I saw it on HN) where violating a UB rule caused an entirely dead piece of code to suddenly be executed, which even made sense after explanation.
In the linked article, Rust-minus-borrow-checker somehow caused an invalid number to appear inside a compile-time static array.
Sure, poke around the results of UB all you want. Curiosity is great. But at some point you'll have to compile your hypothesis as part of valid code, to be able to trust the results.
Re:Turning off Rust's borrow checker, completely
by dtn on Tuesday January 23, 2024 @09:22AM
(#39103618)
I think you're referring to this one: https://blog.tchatzigiannakis.com/undefined-behavior-can-lit...
Bonus read: https://devblogs.microsoft.com/oldnewthing/20140627-00/?p=63...
Re:Turning off Rust's borrow checker, completely
by piaste on Tuesday January 23, 2024 @10:14AM
(#39104416)
Thanks for the link! I think I had in mind another one, where the UB fuckery happened at a lower level (I think you ended up with a semicolon/brace effectively "disappearing"?). But that's a good example too.
If the compiler forced me to check ever integer division wasn’t a divide by zero, that would be annoying in this case. The borrow checker is like this. It forces you to rewrite entire application code just to see if some new behavior fixes a bug, in the name of safety, without realizing that “for just this execution, I don’t care about safety.”