diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-03-18 19:01:01 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-03-18 19:01:01 +0800 |
commit | 91bf537331813d7cddd9dd474d7d3bb2984c9d4a (patch) | |
tree | c5d18001c5f7f25502742765521f6e07fba22193 /src | |
parent | 3aaee59ee3ceab85e88e046336b2fcc72817e89f (diff) | |
download | mrust-91bf537331813d7cddd9dd474d7d3bb2984c9d4a.tar.gz |
HIR Annotate - (minor) Better checking
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_expand/annotate_value_usage.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/hir_expand/annotate_value_usage.cpp b/src/hir_expand/annotate_value_usage.cpp index da4c897f..f21c68ab 100644 --- a/src/hir_expand/annotate_value_usage.cpp +++ b/src/hir_expand/annotate_value_usage.cpp @@ -463,6 +463,7 @@ namespace { return get_usage_for_pattern(sp, *pe.sub, *ty.m_data.as_Borrow().inner); ), (Tuple, + ASSERT_BUG(sp, ty.m_data.is_Tuple(), "Tuple pattern with non-tuple type - " << ty); const auto& subtys = ty.m_data.as_Tuple(); assert(pe.sub_patterns.size() == subtys.size()); auto rv = ::HIR::ValueUsage::Borrow; @@ -471,6 +472,7 @@ namespace { return rv; ), (SplitTuple, + ASSERT_BUG(sp, ty.m_data.is_Tuple(), "SplitTuple pattern with non-tuple type - " << ty); const auto& subtys = ty.m_data.as_Tuple(); assert(pe.leading.size() + pe.trailing.size() < subtys.size()); auto rv = ::HIR::ValueUsage::Borrow; @@ -486,6 +488,7 @@ namespace { (StructTuple, // TODO: Avoid monomorphising all the time. const auto& str = *pe.binding; + ASSERT_BUG(sp, str.m_data.is_Tuple(), "StructTuple pattern with non-tuple struct - " << str.m_data.tag_str()); const auto& flds = str.m_data.as_Tuple(); assert(pe.sub_patterns.size() == flds.size()); auto monomorph_cb = monomorphise_type_get_cb(sp, nullptr, &pe.path.m_params, nullptr); |