this post was submitted on 07 Oct 2026
27 points (100.0% liked)

Rust

8320 readers
26 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] sukhmel@programming.dev 1 points 5 days ago (1 children)

I'm not sure non-exhsustive makes sense — you want the caller to handle everything you may return to them, and the new errors won't be handled. Maybe a default branch in the handler could do, though

[–] TehPers@beehaw.org 3 points 5 days ago

Maybe a default branch in the handler could do, though

This is exactly what it's for. #[non_exhaustive] forces you to add a default branch when matching on the error. It's already used a lot, so without a way to do that, it becomes less useful in library code.