diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-05-12 21:22:44 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-05-12 21:22:44 +0800 |
commit | dc0d4d6766e5f4c15071c14281f4ec03fdd82e6f (patch) | |
tree | 8e2bea95bf7bda587f4171f89780f39019348dc2 /src | |
parent | fceeb41509157b08c2231de0e8277c4eee10303b (diff) | |
download | mrust-dc0d4d6766e5f4c15071c14281f4ec03fdd82e6f.tar.gz |
MIR From HIR - Fix scoping of temporaries in loops
Diffstat (limited to 'src')
-rw-r--r-- | src/mir/from_hir.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 246e2317..99ffd305 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -553,7 +553,9 @@ namespace { auto loop_next = m_builder.new_bb_unlinked(); auto loop_tmp_scope = m_builder.new_scope_temp(node.span()); + auto _ = save_and_edit(m_stmt_scope, &loop_tmp_scope); + // TODO: `continue` in a loop should jump to the cleanup, not the top m_loop_stack.push_back( LoopDesc { mv$(loop_body_scope), node.m_label, loop_block, loop_next } ); this->visit_node_ptr(node.m_code); auto loop_scope = mv$(m_loop_stack.back().scope); @@ -562,7 +564,7 @@ namespace { // If there's a stray result, drop it if( m_builder.has_result() ) { assert( m_builder.block_active() ); - // TODO: Properly drop this? Or just discard it? + // TODO: Properly drop this? Or just discard it? It should be () m_builder.get_result(node.span()); } // Terminate block with a jump back to the start |