I don't think you really understood my comment.
unsafe fn create_null_pointer() -> *const u32 {
std::ptr::null()
}
fn main() {
let ptr = unsafe { create_null_pointer() };
// Dereferencing the null pointer outside of unsafe code
let value = unsafe { *ptr };
println!("Value: {}", value);
}
This will segfault, and the compiler won't warn you about it, even though an error didn't actually happen until you printed the value in "safe" code
What this article is getting at is that the unsafe keyword highlights pieces of code that Google scrutinizes, not that it has functionality that "magically" encapsulates memory bugs. And yes, it's a lot better than C++. But you still need to be aware this can happen and not assume you're safe
All unsafe does is shut off the compiler for sections of the code. You can write code in an unsafe block that bubbles outside of the scope of "unsafe."*