From d011313d843b3ddcf095db06907abffdd9cc5904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 23 Nov 2018 15:37:27 -0800 Subject: [PATCH] Reword EOF in macro arm message --- src/libsyntax/ext/tt/macro_rules.rs | 5 ++++- .../ui/editions/edition-keywords-2018-2015-parsing.stderr | 2 +- .../ui/editions/edition-keywords-2018-2018-parsing.stderr | 2 +- src/test/ui/macros/macro-in-expression-context-2.stderr | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 9f3a80b115161..e731be578cde5 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -59,7 +59,10 @@ impl<'a> ParserAnyMacro<'a> { } let msg = &e.message[0]; e.message[0] = ( - msg.0.replace(", found ``", ", found the end of the macro arm"), + format!( + "macro expansion ends with an incomplete expression: {}", + msg.0.replace(", found ``", ""), + ), msg.1, ); } diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr index 943183814f73f..d0edc368ad5ed 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -22,7 +22,7 @@ error: no rules expected the token `async` LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` | ^^^^^ no rules expected this token in macro call -error: expected one of `move`, `|`, or `||`, found the end of the macro arm +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` --> <::edition_kw_macro_2015::passes_ident macros>:1:25 | LL | ( $ i : ident ) => ( $ i ) diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr index e7379988892b6..c4e1e0257c55c 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -22,7 +22,7 @@ error: no rules expected the token `async` LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` | ^^^^^ no rules expected this token in macro call -error: expected one of `move`, `|`, or `||`, found the end of the macro arm +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` --> <::edition_kw_macro_2018::passes_ident macros>:1:25 | LL | ( $ i : ident ) => ( $ i ) diff --git a/src/test/ui/macros/macro-in-expression-context-2.stderr b/src/test/ui/macros/macro-in-expression-context-2.stderr index f6e6ecf112a3b..672871c49ca5a 100644 --- a/src/test/ui/macros/macro-in-expression-context-2.stderr +++ b/src/test/ui/macros/macro-in-expression-context-2.stderr @@ -1,4 +1,4 @@ -error: expected expression, found the end of the macro arm +error: macro expansion ends with an incomplete expression: expected expression --> $DIR/macro-in-expression-context-2.rs:5:16 | LL | macro_rules! empty { () => () }