4 ms·
IIRC, `let x = foo()?` is actually equivalent to let x = match foo() { Ok(value) -> value, Err(e) -> return Err(e.into()), } Which can automat
by cesarb 4y ago
IIRC, `let x = foo()?` is actually equivalent to
let x = match foo() {
Ok(value) -> value,
Err(e) -> return Err(e.into()),
}
Which can automatically convert one error type into another when the appropriate From and/or Into impls exist.
- steveklabnik 4y agoIt is a little more complex than that these days https://github.com/rust-lang/rust/blob/4e0d0d757e2f1b61ec809420b006545a9f8974c0/compiler/rustc_ast_lowering/src/expr.rs#L1565-L1576 https://github.com/rust-lang/rust/blob/4e0d0d757e2f1b61ec809...