Closed
Description
Opening as #39849 (linked from tracking issue #31436) is closed.
If no exception is thrown, then the result is Ok(v) where v is the value of the block.
The current implementation does not; the following does not compile (2017-04-18):
let _: Result<i32, ()> = do catch { 4 };
Error message:
error[E0308]: mismatched types
--> src/main.rs:3:41
|
3 | let _: Result<i32, ()> = do catch { 4 };
| ^ expected enum `std::result::Result`, found integral variable
|
= note: expected type `std::result::Result<i32, ()>`
found type `{integer}`
Runnable: https://play.integer32.com/?gist=4e589a7b8f2ffff23f507fb66ac7f662&version=nightly
cc @nikomatsakis, who mentioned this in rust-lang/rfcs#1859 (comment)