summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2017-08-23 21:20:15 +0800
committerJohn Hodge <tpg@mutabah.net>2017-08-31 16:54:58 +0800
commit18130195d7e6c870d43d8bfdbf8d573534076c01 (patch)
treeda6edfc0d94cee7c94a1df90d942c84bc329f536
parentbeadcf83172ca0338ae7294437c5ee36fd8d4c13 (diff)
downloadmrust-18130195d7e6c870d43d8bfdbf8d573534076c01.tar.gz
Expand - Handle #[cfg] on match arms
-rw-r--r--src/expand/cfg.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/expand/cfg.cpp b/src/expand/cfg.cpp
index 02f0c9b1..64e8a58e 100644
--- a/src/expand/cfg.cpp
+++ b/src/expand/cfg.cpp
@@ -169,6 +169,13 @@ class CCfgHandler:
i.m_name = "";
}
}
+
+ void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::ExprNode_Match_Arm& i) const override {
+ DEBUG("#[cfg] match arm - " << mi);
+ if( !check_cfg(sp, mi) ) {
+ i.m_patterns.clear();
+ }
+ }
void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::ExprNode_StructLiteral::Ent& i) const override {
DEBUG("#[cfg] struct lit - " << mi);
if( !check_cfg(sp, mi) ) {