Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
tialaramex
23 days ago
|
parent
|
context
|
favorite
| on:
Stabilizing Rust's Never Type
And if your callers are generic over the error type, and so they do
have
code for handling errors, the compiler won't emit this code for your result type because you've said its error type can't exist.
tyre
23 days ago
[–]
Does that mean you can assign the result of the function without explicitly unwrapping? Or that the compiler removes the call to unwrap? Or neither?
bonzini
23 days ago
|
parent
[–]
You need to unwrap but the compiler removes the call. If instead you know that the callee is infallible you can also do
let Ok(x) = call_that_cant_fail();
Consider applying for YC's Winter 2027 batch!
Applications
are open till November 2.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: