3 ms·
People unfamiliar with Rust and even some people familiar with Rust frequently get confused about use of unsafe. Even in the case of this actix debacle there's
by dodobirdlord 7y ago
People unfamiliar with Rust and even some people familiar with Rust frequently get confused about use of unsafe. Even in the case of this actix debacle there's a lot of misunderstanding circulating. There's nothing wrong with using unsafe code, and it's frequently necessary for things like explicit SIMD or invoking compiler intrinsics. The Rust community (barring maybe some of the lowest of low-information individuals circling around Reddit/HN) are not going to get on anyone's case about using unsafe. But using unsafe isn't a get out of jail free card, and it doesn't allow you to break any of Rust's invariants, it is used to indicate that the programmer has ensured that the invariants are upheld, rather than the compiler. If you use unsafe to violate an invariant then you have written a bug and introduced UB. Is anyone going to get on your case about writing bugs in your open source project? Probably depends on how popular the project is and how you portray it. If you advertise it as production-ready and it gets popular and then it is discovered that it'd riddled with UB bugs people are probably going to be annoyed.
Also, the internet being the way it is, if you use unsafe correctly to do things that you could have done with safe code, where the compiler would have produced the same result either way, rude internet people will probably be rude to you.