summaryrefslogtreecommitdiff
path: root/src/ast/ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-24 19:49:10 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-24 19:49:10 +0800
commit6ed590cce27edbdcc13cdd478d8a68c81da44596 (patch)
tree4f1199797b6d27ccad637f64a016d1553d24b067 /src/ast/ast.cpp
parent9b7e985f35138594f1bc393a9b792113417fa8f5 (diff)
downloadmrust-6ed590cce27edbdcc13cdd478d8a68c81da44596.tar.gz
AST - More defensive `self: Box<Self>` code
Diffstat (limited to 'src/ast/ast.cpp')
-rw-r--r--src/ast/ast.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index 80182f85..70a61b32 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -320,6 +320,9 @@ Function::Function(Span sp, GenericParams params, TypeRef ret_type, Arglist args
TU_IFLET( ::AST::Path::Class, e.path.m_class, Relative, pe,
if( pe.nodes.size() == 1 && pe.nodes.front().name() == "Box" )
{
+ if( pe.nodes.front().args().m_types.size() != 1 ) {
+ ERROR(sp, E0000, "Box takes 1 argument - " << ty);
+ }
// HACK: Assumes that the param is Self or equivalent
m_receiver = Receiver::Box;
}