diff options
| author | Keegan McAllister <kmcallister@mozilla.com> | 2015-02-25 17:11:36 -0800 |
|---|---|---|
| committer | Keegan McAllister <kmcallister@mozilla.com> | 2015-02-25 17:13:16 -0800 |
| commit | 65ea9110bd930dc74b0fc37bf151dbbce80fe4ee (patch) | |
| tree | eeb882564ec59f401f40ae21e892e77b28469d25 /src/libsyntax/ext | |
| parent | 880fb89bde126aa43fc348d0b93839d3d18a1f51 (diff) | |
| download | rust-65ea9110bd930dc74b0fc37bf151dbbce80fe4ee.tar.gz rust-65ea9110bd930dc74b0fc37bf151dbbce80fe4ee.zip | |
Always error on invalid macro fragment specifiers
Fixes #21370. unused-macro-with-follow-violation.rs was already handled correctly. That test is just for good measure. :)
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index fa6d934a457..67011ad21a6 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -334,6 +334,10 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token) let tok = if let TtToken(_, ref tok) = *token { tok } else { unreachable!() }; // If T' is in the set FOLLOW(NT), continue. Else, reject. match (&next_token, is_in_follow(cx, &next_token, frag_spec.as_str())) { + (_, Err(msg)) => { + cx.span_err(sp, &msg); + continue + } (&Eof, _) => return Some((sp, tok.clone())), (_, Ok(true)) => continue, (next, Ok(false)) => { @@ -343,10 +347,6 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token) token_to_string(next))); continue }, - (_, Err(msg)) => { - cx.span_err(sp, &msg); - continue - } } }, TtSequence(sp, ref seq) => { |
