Skip to content

Commit

Permalink
Lower MIR - Handle return with diverging result (Fixes #275)
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Sep 27, 2023
1 parent 8680fe7 commit ed60973
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions samples/test/mrustc-275.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn fun1() -> () {
return {
return ();
};
}

fn main() {}
4 changes: 4 additions & 0 deletions src/mir/from_hir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ namespace {
TRACE_FUNCTION_F("_Return");
this->visit_node_ptr(node.m_value);

if( !m_builder.block_active() ) {
return ;
}

if( m_is_generator )
{
::HIR::GenericPath enm_path;
Expand Down

0 comments on commit ed60973

Please sign in to comment.