Remix.run Logo
▲ masklinn an hour ago

OTOH that panics are ok and easy to reach for and unwind is why you have to handle them and keep the program running.

I don’t think that an unwind-less rust would have fit within the weirdness budget 10 years ago, today it would definitely be something to consider. Although it would have an unwind effect to contend with.

▲Xirdus an hour ago | parent [-]

It would be entirely unsuitable for the kind of project I work on in my day job, which requires running user-provided code (trusted code, but one that may contain many bugs) in 100 different worker threads, and if one of them crashes the other 99 must keep running. Without unwinding and recovery, we'd have to completely redesign the whole application, probably to multiprocess architecture with all its downsides.

▲cowlevel 17 minutes ago | parent [-]

What do you do if they segfault on raw pointers? Does Rust's runtime catch SIGSEGV and translate it to a panic?

You can also get SIGBUS by mapping a file beyond the end of the file and then trying to read the extra bytes. If Rust's version of mmap checks this, you can still do it by truncating the file while it's mapped.