diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-23 11:36:23 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-23 11:36:23 +0800 |
commit | 28b1e61bd288a0e55cc0c6cb2d6c98be6983b0a1 (patch) | |
tree | 866702e46728eaa063dfdf20218dc6dcc5cc4e98 /src/resolve/use.cpp | |
parent | 5bc5d0122bf5f38ef394b9f3363995193c476530 (diff) | |
download | mrust-28b1e61bd288a0e55cc0c6cb2d6c98be6983b0a1.tar.gz |
Resolve - Place struct enum variants in the type namespace, fix serialisation bug
Diffstat (limited to 'src/resolve/use.cpp')
-rw-r--r-- | src/resolve/use.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index b376e21f..0196108f 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -575,6 +575,7 @@ namespace { auto p = e.path; p.m_components.pop_back(); const auto& enm = ec.m_hir->get_typeitem_by_path(span, p, true).as_Enum(); + assert(e.idx < enm.m_variants.size()); return ::AST::PathBinding::make_EnumVar({ nullptr, e.idx, &enm }); } if( e.path.m_components.empty() ) @@ -619,6 +620,7 @@ namespace { auto p = e.path; p.m_components.pop_back(); const auto& enm = ec.m_hir->get_typeitem_by_path(span, p, true).as_Enum(); + assert(e.idx < enm.m_variants.size()); return ::AST::PathBinding::make_EnumVar({ nullptr, e.idx, &enm }); } item_ptr = &ec.m_hir->get_valitem_by_path(span, e.path, true); // ignore_crate_name=true |