diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-20 15:33:22 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-20 15:33:22 +0800 |
commit | 8df12b977534b11b4016b0fc4080141a4bea689e (patch) | |
tree | 2670e10bf1b687659abc36b90c802b4a188aaedd /src/mir/from_hir.cpp | |
parent | 2d10f135e8c6455feab799dedc38e2b3b70fe89c (diff) | |
download | mrust-8df12b977534b11b4016b0fc4080141a4bea689e.tar.gz |
MIR Gen - Fix codegen issue with use of moved LValue
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r-- | src/mir/from_hir.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index f54ead5a..001fe62e 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -443,7 +443,6 @@ namespace { ASSERT_BUG(sp, ty_slot.m_data.is_Primitive(), "Assignment operator overloads are only valid on primitives - ty_slot="<<ty_slot); ASSERT_BUG(sp, ty_val.m_data.is_Primitive(), "Assignment operator overloads are only valid on primitives - ty_val="<<ty_val); - ::MIR::RValue res; #define _(v) ::HIR::ExprNode_Assign::Op::v ::MIR::eBinOp op; switch(node.m_op) @@ -470,8 +469,6 @@ namespace { break; } #undef _ - - m_builder.push_stmt_assign(mv$(dst), mv$(res)); } else { @@ -1335,11 +1332,14 @@ void MirBuilder::set_result(const Span& sp, ::MIR::RValue val) void MirBuilder::push_stmt_assign(::MIR::LValue dst, ::MIR::RValue val) { ASSERT_BUG(Span(), m_block_active, "Pushing statement with no active block"); + ASSERT_BUG(Span(), dst.tag() != ::MIR::LValue::TAGDEAD, ""); + ASSERT_BUG(Span(), val.tag() != ::MIR::RValue::TAGDEAD, ""); m_output.blocks.at(m_current_block).statements.push_back( ::MIR::Statement::make_Assign({ mv$(dst), mv$(val) }) ); } void MirBuilder::push_stmt_drop(::MIR::LValue val) { ASSERT_BUG(Span(), m_block_active, "Pushing statement with no active block"); + ASSERT_BUG(Span(), val.tag() != ::MIR::LValue::TAGDEAD, ""); m_output.blocks.at(m_current_block).statements.push_back( ::MIR::Statement::make_Drop({ ::MIR::eDropKind::DEEP, mv$(val) }) ); } |