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

I agree, I like e.g. https://doc.rust-lang.org/std/string/struct.FromUtf8Error.ht...

See, we were trying to make this data we had into a string, Rust says all strings are UTF-8 encoded - but, turns out the data wasn't UTF-8 after all, here's an error with the data inside it.

Or a really delicate piece of design, (nightly for now) Vec::push_within_capacity. We're hoping the growable array (Vec<T>) has enough space for this T, thus getting rid of it, but if not we don't want to grow the array, maybe we're bare metal software and can't afford to allocate on this hot path, so we get back an error with the T we were trying to push onto the array inside it, so we can do something else with that T but only when the problem happened, otherwise it's gone.



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

Search: