diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-30 21:12:28 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-30 21:12:28 +0800 |
commit | deefbda0e18dd5ce8149d30bbea06b5526fc8427 (patch) | |
tree | 36c7ecbca5b08b07d49d0671c18023004b3109a2 /src | |
parent | d0ff2392e7d015174d300a2818f613bc0257679c (diff) | |
download | mrust-deefbda0e18dd5ce8149d30bbea06b5526fc8427.tar.gz |
MIR - Misc fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/mir/cleanup.cpp | 2 | ||||
-rw-r--r-- | src/mir/from_hir.cpp | 6 | ||||
-rw-r--r-- | src/trans/enumerate.cpp | 6 |
3 files changed, 8 insertions, 6 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()) ); ) ) ), diff --git a/src/trans/enumerate.cpp b/src/trans/enumerate.cpp index c29e5dfc..1750e730 100644 --- a/src/trans/enumerate.cpp +++ b/src/trans/enumerate.cpp @@ -254,7 +254,7 @@ namespace { BUG(Span(), "Generic type hit in enumeration - " << ty); ), (ErasedType, - BUG(Span(), "ErasedType hit in enumeration - " << ty); + //BUG(Span(), "ErasedType hit in enumeration - " << ty); ), (Closure, BUG(Span(), "Closure type hit in enumeration - " << ty); @@ -594,7 +594,9 @@ namespace { impl_pp.m_types = mv$(best_impl_params); TU_MATCHA( (trait_vi), (ve), - (Constant, TODO(sp, "Associated constant"); ), + (Constant, + TODO(sp, "Associated constant - " << path); + ), (Static, auto it = impl.m_statics.find(e.item); if( it != impl.m_statics.end() ) |