4 ms·
What are some examples of things you "always" need that require unsafe Rust?
by duped 1mo ago
What are some examples of things you "always" need that require unsafe Rust?
- yefol 1mo ago[dead]
- afdbcreid 1mo ago> for instance by causing a stack overflow That's not "for instance", that's literally the only place Rust has unfixable UB on embedded (code on OS has other such things, e.g. reading/writing to `/proc/self/mem`). > projects that need performance often use unsafe You'll be surprised to hear how often it's not needed at all. And when it is, you'll be surprised to hear how many times you can still avoid it with some tricks. Contrary to popular belief, performance isn't the most common reason for unsafe (FFI probably is).
- insanitybit 1mo agoI haven't needed `unsafe` for performance since crates like zerocopy etc exist. It's been years, and I've worked hard to shave nanoseconds off of code, using valgrind to measure single digit changes to branch predictions.
- delamon 1mo agoObjects belonging to multiple double-linked lists at the same time. Easily done with intrusive lists. Safe rust would require Rc/Arc: penalty both on memory usage and cpu time.