this post was submitted on 21 Nov 2025
269 points (96.5% liked)
Technology
77018 readers
2153 users here now
This is a most excellent place for technology news and articles.
Our Rules
- Follow the lemmy.world rules.
- Only tech related news or articles.
- Be excellent to each other!
- Mod approved content bots can post up to 10 articles per day.
- Threads asking for personal tech support may be deleted.
- Politics threads may be removed.
- No memes allowed as posts, OK to post as comments.
- Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
- Check for duplicates before posting, duplicates may be removed
- Accounts 7 days and younger will have their posts automatically removed.
Approved Bots
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
No, I responded to the relevant part. I was using
segfaultas a metaphor, not arguing that it's actually the same mechanism underneath. If you're getting panics in production code, I consider that just as much of an emergency to fix as a segfault, and Rust helpfully gives you stack trace info with it. It's not the same idea as an exception, which could signify an unrecoverable error or an expected issue that can be recovered from.It forces you to write a message, so most temporary uses will be
unwrap(). I useunwrap()all the time when prototyping for the happy path, and then do proper error handling later. This is especially true in larger projects where I can't just throw inanyhowor something and actually need to map error types and whatnot. I don't useexpect()much (current hobby project has 4 uses, 3 for startup issues and 1 for hopefully impossible condition) but I think it makes sense when there's no way to continue.But yes,
unwrap()is perhaps the first thing I look for as a reviewer, which is why it's so surprising that this is the issue. At the very least, it should have been something likeexpect("exceeds max file size"). I personally prefer explicit panics in production code, but expect is close enough that it's personal preference.