summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-13 19:39:10 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-13 19:39:10 +0800
commit4534f1e5acb1deaf1efccc0f91a8e0c09c163259 (patch)
treef68b0e27da0d693af403fe1846a5186c57e8bdac /src
parent95ce90b256f43c18b1d813b6d2c058efce84f325 (diff)
downloadmrust-4534f1e5acb1deaf1efccc0f91a8e0c09c163259.tar.gz
Derive PartialEq - Add default arm for enums
Diffstat (limited to 'src')
-rw-r--r--src/expand/derive.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/expand/derive.cpp b/src/expand/derive.cpp
index 8bd73295..3b20607b 100644
--- a/src/expand/derive.cpp
+++ b/src/expand/derive.cpp
@@ -481,6 +481,15 @@ public:
mv$(code)
));
}
+
+ // Default arm
+ {
+ arms.push_back(AST::ExprNode_Match_Arm(
+ ::make_vec1( AST::Pattern() ),
+ nullptr,
+ NEWNODE(Block, {}, nullptr)
+ ));
+ }
::std::vector<AST::ExprNodeP> vals;
vals.push_back( NEWNODE(NamedValue, AST::Path("self")) );