Re:Will Hare replace C? Or Rust? Or Zig? Or anything else?
by uecker on Tuesday May 03, 2022 @12:15PM
(#31250078)
It is not enough to check your unsafe code for UB, you also need to make sure it does not violate the invariants Rust relies on to prove the safe code safe.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else?
by cyber_kinetist on Tuesday May 03, 2022 @12:28PM
(#31250220)
...which I consider as one of the bullet points in the list when checking UB in unsafe code.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else?
by staticassertion on Tuesday May 03, 2022 @03:24PM
(#31252385)
????
Whatever that means lol
You mean the borrow checker? People are working on formally proving that, and have already done so for large subsets of the language.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else?
by ColonelPhantom on Wednesday May 04, 2022 @02:16PM
(#31263954)
They mean that in unsafe code, you have to adhere to some rules to prevent safe code from becoming unsafe.
In other words, incorrect code in "unsafe Rust" can cause safety issues that only appear when you use it in a certain way from "safe Rust".
Safe Rust cannot ever cause undefined behavior, but Unsafe Rust can. The ultimate merit of Rust is that when you suspect any undefined behavior you only need to check the unsafe part, which is a much smaller percentage of your codebase (as opposed to C/C++ where you need to check the entirety of your code)