Skip to content

Commit

Permalink
Reword EOF in macro arm message
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 23, 2018
1 parent 950a3ed commit d011313
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/libsyntax/ext/tt/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ impl<'a> ParserAnyMacro<'a> {
}
let msg = &e.message[0];
e.message[0] = (
msg.0.replace(", found `<eof>`", ", found the end of the macro arm"),
format!(
"macro expansion ends with an incomplete expression: {}",
msg.0.replace(", found `<eof>`", ""),
),
msg.1,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/macros/macro-in-expression-context-2.stderr
Original file line number Diff line number Diff line change
@@ -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 { () => () }
Expand Down

0 comments on commit d011313

Please sign in to comment.