News for hackers. Stuff that matters.
Re:Push ifs up and fors down by LegionMammal978 on Wednesday November 15, 2023 @09:36PM (#38285289)
Indeed, Rust's own standard library uses this method. There are lots of public-facing unsafe functions that can result in undefined behavior if called incorrectly. But if the standard library is compiled in debug mode (which currently requires the unstable flag -Zbuild-std), then it will activate assertions on many of these unsafe functions, so that they will print a message and abort the program if they detect invalid input.
Re:Push ifs up and fors down by afdbcreid on Thursday November 16, 2023 @06:38AM (#38288332)
The Rust compiler has even started recently to put extra checks on unsafe code in codegen, e.g. on raw pointer dereference to check it is aligned.