Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I write Rust at $WORK. Using `unsafe` to meet a deadline makes 0 sense. It doesn't disable the borrow checker unless you're literally casting references through raw pointers to strip lifetimes, which is... insane and would never pass a code review.

99% of the time if you're fighting the borrow checker and just want a quick solution, that solution is `clone` or `Arc<Mutex<T>>`, not `unsafe`. Those solutions will sacrifice performance, but not safety.



> Using `unsafe` to meet a deadline makes 0 sense... would never pass a code review.

I've seen unsound unchecked casts from &UnsafeCell or *mut to &mut in multiple codebases, including Firefox itself: https://github.com/emu-rs/snes-apu/blob/13c1752c0a9d43a32d05..., https://searchfox.org/mozilla-central/rev/7142c947c285e4fe4f....


My girlfriend uses Rust for embedded systems at a large and important company. Everyone uses memory safety.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: