diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-10-25 10:09:19 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-11-23 15:37:31 -0800 |
| commit | ea9ccb6046aa1733aa1761fc942f8432fb63f107 (patch) | |
| tree | db42da1149aebe1315d35101666bd5bee8c29c96 /src/libsyntax/ext/tt/macro_parser.rs | |
| parent | 910ec6d97ff03549c22352d7763be02b60d73470 (diff) | |
| download | rust-ea9ccb6046aa1733aa1761fc942f8432fb63f107.tar.gz rust-ea9ccb6046aa1733aa1761fc942f8432fb63f107.zip | |
Point at end of macro arm when encountering EOF
Fix #52866
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index f31d80acbfa..26604c46be5 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -724,7 +724,14 @@ pub fn parse( "ambiguity: multiple successful parses".to_string(), ); } else { - return Failure(parser.span, token::Eof); + return Failure( + if parser.span.is_dummy() { + parser.span + } else { + sess.source_map().next_point(parser.span) + }, + token::Eof, + ); } } // Performance hack: eof_items may share matchers via Rc with other things that we want @@ -757,7 +764,7 @@ pub fn parse( ); } // If there are no possible next positions AND we aren't waiting for the black-box parser, - // then their is a syntax error. + // then there is a syntax error. else if bb_items.is_empty() && next_items.is_empty() { return Failure(parser.span, parser.token); } |
