diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-11-26 11:27:18 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-11-26 11:27:18 +0800 |
commit | ae9b8fb6a738d0f8be49c63d846ca713eaa2eab1 (patch) | |
tree | 333acaf0abb53f58fa5c76ebf1f047dae55c9ba6 | |
parent | 83beaea9602af2c2cf0ddd690a74ebb8d09762b8 (diff) | |
download | mrust-ae9b8fb6a738d0f8be49c63d846ca713eaa2eab1.tar.gz |
macro_rules - Fix parsing of loop labels
-rw-r--r-- | disabled_tests_run-pass.txt | 4 | ||||
-rw-r--r-- | src/macro_rules/eval.cpp | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/disabled_tests_run-pass.txt b/disabled_tests_run-pass.txt index a0cdb566..2aa127a9 100644 --- a/disabled_tests_run-pass.txt +++ b/disabled_tests_run-pass.txt @@ -21,11 +21,11 @@ deriving-copyclone # BUG: `derive(Copy,Clone)` generates a standard clone impl format-ref-cell # BUG: format_args! ordering ifmt # MISSING: Support for * in format_args! hygiene # TODO: Attempted to copy a :expr fragment (shouldn't error, bug in impl?) -hygienic-labels # BUG: macro_rules eval doesn't support break/continue labels -hygienic-labels-in-let # ^ issue-11085 # MISSING: cfg() on enum variants issue-15221 # BUG: macro_rules eval - :pat in :pat issue-18859 # BUG: module_path! doesn't include crate name +hygienic-labels # BUG: hygine doesn't apply to loop labels +hygienic-labels-in-let # ^ # codegen-units sepcomp-fns diff --git a/src/macro_rules/eval.cpp b/src/macro_rules/eval.cpp index 6344b26a..fc54616e 100644 --- a/src/macro_rules/eval.cpp +++ b/src/macro_rules/eval.cpp @@ -1116,6 +1116,9 @@ namespace return consume_tt(lex); } break; + case TOK_RWORD_BOX: + lex.consume(); + return consume_pat(lex); case TOK_AMP: case TOK_DOUBLE_AMP: lex.consume(); @@ -1202,6 +1205,7 @@ namespace case TOK_STAR: // Deref case TOK_DASH: // Negate case TOK_EXCLAM: // Invert + case TOK_RWORD_BOX: // Box lex.consume(); break; case TOK_AMP: @@ -1222,9 +1226,12 @@ namespace switch(lex.next()) { case TOK_RWORD_CONTINUE: - case TOK_RWORD_RETURN: case TOK_RWORD_BREAK: lex.consume(); + lex.consume_if(TOK_LIFETIME); + if(0) + case TOK_RWORD_RETURN: + lex.consume(); switch(lex.next()) { case TOK_EOF: |