Closed
Description
#![feature(catch_expr, never_type)]
struct Error {
cause: &'static str,
}
fn oops() -> Result<(), Error> {
Err(Error { cause: "epic fail" } )
}
fn main() {
let Err(Error { cause }): Result<!, Error> = do catch {
oops()?;
return; // OK
};
eprintln!("Nuclear meltdown initiated: {}", cause);
}
error: internal compiler error: broken MIR (_1 = ()): bad assignment (! = ()): Sorts(ExpectedFound { expected: !, found: () })
--> src/main.rs:11:11
|
11 | fn main() {
| ___________^
12 | | let Err(Error { cause }): Result<!, Error> = do catch {
13 | | oops()?;
14 | | return; // OK
15 | | };
16 | | eprintln!("Nuclear meltdown initiated: {}", cause);
17 | | }
| |_^