summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-02-24 13:37:58 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-02-24 13:37:58 +0800
commit98ad2235464a00fab4287388ccd11b75a978d640 (patch)
tree1cb84650b235ed5fdf1a0893b1ff0b0d0a522350
parent1b173dc2281022b42560f169a5f7445ba9528f6c (diff)
downloadmrust-98ad2235464a00fab4287388ccd11b75a978d640.tar.gz
macro_rules - Allow macros for :type
-rw-r--r--disabled_tests_run-pass.txt1
-rw-r--r--src/macro_rules/eval.cpp11
2 files changed, 10 insertions, 2 deletions
diff --git a/disabled_tests_run-pass.txt b/disabled_tests_run-pass.txt
index b1401cb3..883d5026 100644
--- a/disabled_tests_run-pass.txt
+++ b/disabled_tests_run-pass.txt
@@ -81,7 +81,6 @@ stmt_expr_attr_macro_parse # macro_rules - attributes not consumed as part of :
sync-send-iterators-in-libcollections # macro_rules - :expr matching bare ..
trait-item-inside-macro # TODO: Allow macro invocations in traits
try-operator-custom # TODO: use the ops::Try trait instead of try! desugar
-type-macros-hlist # Missed expansion in UFCS
type-macros-simple # macro_rules ordering with nested items
# Requires unwinding panics
diff --git a/src/macro_rules/eval.cpp b/src/macro_rules/eval.cpp
index 24adac3e..9372fa6e 100644
--- a/src/macro_rules/eval.cpp
+++ b/src/macro_rules/eval.cpp
@@ -1074,7 +1074,16 @@ namespace
case TOK_DOUBLE_COLON:
case TOK_INTERPOLATED_IDENT:
case TOK_INTERPOLATED_PATH:
- return consume_path(lex, true);
+ if( !consume_path(lex, true) )
+ return false;
+ if( lex.consume_if(TOK_EXCLAM) )
+ {
+ if( lex.next() != TOK_PAREN_OPEN && lex.next() != TOK_SQUARE_OPEN && lex.next() != TOK_BRACE_OPEN )
+ return false;
+ if( !consume_tt(lex) )
+ return false;
+ }
+ return true;
case TOK_AMP:
case TOK_DOUBLE_AMP:
lex.consume();