News for hackers. Stuff that matters.
Re:Pitfalls of Safe Rust by int_19h on Monday April 07, 2025 @01:22PM (#43613809)
The difference is that C# has well-defined behavior in this case - a non-nullable notification is really "not-nullable-ish", and there are cases even in the language itself where code without any casts in it will observe null values of such types. It's just a type system hole they allow for convenience and back-compat.

OTOH with Rust you'd have to violate its safety guarantees, which if I understand correctly triggers UB.

Re:Pitfalls of Safe Rust by steveklabnik on Monday April 07, 2025 @03:26PM (#43614953)
> which if I understand correctly triggers UB.

Yes, your parent's example would be UB, and require unsafe.