```rust #![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 | | } | |_^ ```
Activity
crumblingstatue commentedon Jul 19, 2017
Interestingly, if you add
return ();at the end, the ICE disappears, leading to #43336.scottmcm commentedon Sep 2, 2017
Looks like this can be triggered with only
catch_expr(withoutnever_type) by using aloop:https://play.rust-lang.org/?gist=32c33a234dd7a8d6a8e961d4121b885e&version=nightly
varkor commentedon Feb 11, 2018
Looks like this is fixed now (I suspect by #47746).