summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-09 13:58:35 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-09 13:58:35 +0800
commit9d7c60d6c556c9659329490b34a601df3dea2ce6 (patch)
treea2fd5178f50ce0082207328a34dde8e40393b760
parent81c4bb2423b425ce5e19550d4984363e0e8dc8ac (diff)
downloadmrust-9d7c60d6c556c9659329490b34a601df3dea2ce6.tar.gz
Resolve Use - Fix an edge-case crash, insert TODO
-rw-r--r--src/resolve/use.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp
index c2079bdd..43496064 100644
--- a/src/resolve/use.cpp
+++ b/src/resolve/use.cpp
@@ -50,7 +50,7 @@ void Resolve_Use(::AST::Crate& crate)
),
(Self,
// EVIL HACK: If the current module is an anon module, refer to the parent
- if( base_path.nodes().back().name()[0] == '#' ) {
+ if( base_path.nodes().size() > 0 && base_path.nodes().back().name()[0] == '#' ) {
AST::Path np("", {});
for( unsigned int i = 0; i < base_path.nodes().size() - 1; i ++ )
np.nodes().push_back( base_path.nodes()[i] );
@@ -431,7 +431,10 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path
}
TU_MATCH_DEF( ::HIR::TypeItem, (it->second->ent), (e),
(
- ERROR(span, E0000, "Unexpected item type in import");
+ ERROR(span, E0000, "Unexpected item type in import " << path << " @ " << i << " - " << it->second->ent.tag_str());
+ ),
+ (Import,
+ TODO(span, "Recursive import " << nodes[i].name() << " = " << e << " in path " << path);
),
(Module,
hmod = &e;