summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-10-01 11:11:52 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-10-01 11:11:52 +0800
commitab7df1d155b46da13d7734737315a187c50e1734 (patch)
tree52e8d71d9ba2701d83a437d0551645adc71c444d
parent43366c9e53791255159adbb2b391dd96749f9553 (diff)
downloadmrust-ab7df1d155b46da13d7734737315a187c50e1734.tar.gz
Resolve - Search for unit-like structs in pattern lookup
-rw-r--r--src/resolve/absolute.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp
index 8b5732a8..ef635ef0 100644
--- a/src/resolve/absolute.cpp
+++ b/src/resolve/absolute.cpp
@@ -339,6 +339,18 @@ namespace
case ::AST::PathBinding::TAG_Static:
path = ::AST::Path( v->second.path );
return true;
+ case ::AST::PathBinding::TAG_Struct:
+ // TODO: Restrict this to unit-like structs
+ if( b.as_Struct().struct_ && !b.as_Struct().struct_->m_data.is_Unit() )
+ ;
+ else if( b.as_Struct().hir && !b.as_Struct().hir->m_data.is_Unit() )
+ ;
+ else
+ {
+ path = ::AST::Path( v->second.path );
+ return true;
+ }
+ break;
default:
break;
}