diff options
Diffstat (limited to 'src/hir')
-rw-r--r-- | src/hir/from_ast.cpp | 7 | ||||
-rw-r--r-- | src/hir/hir.cpp | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index dfe6b8ab..b0768a84 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -690,10 +690,8 @@ for(const auto& t : e.traits) { const auto& tb = t.binding().as_Trait(); - if( tb.trait_ && tb.trait_->is_marker() ) { - v.m_markers.push_back( LowerHIR_GenericPath(ty.span(), t) ); - } - else if( tb.hir && tb.hir->m_is_marker ) { + assert( tb.trait_ || tb.hir ); + if( (tb.trait_ && tb.trait_->is_marker()) || (tb.hir->m_is_marker) ) { v.m_markers.push_back( LowerHIR_GenericPath(ty.span(), t) ); } else { @@ -704,6 +702,7 @@ v.m_trait = LowerHIR_TraitPath(ty.span(), t); } } + ASSERT_BUG(ty.span(), v.m_trait.m_path.m_path.m_components.size() > 0, "TraitObject type didn't contain a data trait - " << ty); return ::HIR::TypeRef( ::HIR::TypeRef::Data::make_TraitObject( mv$(v) ) ); ), (Function, diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index d0a825f8..6b50c0f2 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -375,9 +375,7 @@ const ::HIR::SimplePath& ::HIR::Crate::get_lang_item_path(const Span& sp, const const ::HIR::TypeItem& ::HIR::Crate::get_typeitem_by_path(const Span& sp, const ::HIR::SimplePath& path) const { - if( path.m_components.size() == 0) { - BUG(sp, "get_typeitem_by_path received invalid path"); - } + ASSERT_BUG(sp, path.m_components.size() > 0, "get_typeitem_by_path received invalid path - " << path); const ::HIR::Module* mod; if( path.m_crate_name != "" ) { |