summaryrefslogtreecommitdiff
path: root/src/mir
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-12-30 21:12:28 +0800
committerJohn Hodge <tpg@mutabah.net>2016-12-30 21:12:28 +0800
commitdeefbda0e18dd5ce8149d30bbea06b5526fc8427 (patch)
tree36c7ecbca5b08b07d49d0671c18023004b3109a2 /src/mir
parentd0ff2392e7d015174d300a2818f613bc0257679c (diff)
downloadmrust-deefbda0e18dd5ce8149d30bbea06b5526fc8427.tar.gz
MIR - Misc fixes
Diffstat (limited to 'src/mir')
-rw-r--r--src/mir/cleanup.cpp2
-rw-r--r--src/mir/from_hir.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mir/cleanup.cpp b/src/mir/cleanup.cpp
index 9b63299d..5c15c1a0 100644
--- a/src/mir/cleanup.cpp
+++ b/src/mir/cleanup.cpp
@@ -88,6 +88,8 @@ const ::HIR::Literal* MIR_Cleanup_GetConstant(const Span& sp, const StaticTraitR
resolve.find_impl(sp, pe.trait.m_path, pe.trait.m_params, *pe.type, [&](auto impl_ref, auto is_fuzz) {
DEBUG("Found " << impl_ref);
+ if( !impl_ref.m_data.is_TraitImpl() )
+ return true;
const auto& impl_ref_e = impl_ref.m_data.as_TraitImpl();
const auto& impl = *impl_ref_e.impl;
ASSERT_BUG(sp, impl.m_trait_args.m_types.size() == pe.trait.m_params.m_types.size(), "Trait parameter count mismatch " << impl.m_trait_args << " vs " << pe.trait.m_params);
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index a6a5aa32..4f72099d 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -1793,15 +1793,13 @@ namespace {
ASSERT_BUG(sp, it != tr.m_values.end(), "Cannot find trait item for " << node.m_path);
TU_MATCHA( (it->second), (e),
(Constant,
- m_builder.set_result( sp, ::MIR::Constant::make_ItemAddr(node.m_path.clone()) );
+ m_builder.set_result( sp, ::MIR::Constant::make_Const({node.m_path.clone()}) );
),
(Static,
TODO(sp, "Associated statics (non-rustc) - " << node.m_path);
),
(Function,
- auto tmp = m_builder.new_temporary( node.m_res_type.clone() );
- m_builder.push_stmt_assign( sp, tmp.clone(), ::MIR::Constant::make_ItemAddr(node.m_path.clone()) );
- m_builder.set_result( sp, mv$(tmp) );
+ m_builder.set_result( sp, ::MIR::Constant::make_ItemAddr(node.m_path.clone()) );
)
)
),