diff options
Diffstat (limited to 'compiler/rustc_expand')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_rules.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 10b2b9f07e2..2ed11204ef6 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -68,17 +68,18 @@ fn emit_frag_parse_err( arm_span: Span, kind: AstFragmentKind, ) { - if parser.token == token::Eof && e.message().ends_with(", found `<eof>`") { + // FIXME(davidtwco): avoid depending on the error message text + if parser.token == token::Eof && e.message().as_str().ends_with(", found `<eof>`") { if !e.span.is_dummy() { // early end of macro arm (#52866) e.replace_span_with(parser.sess.source_map().next_point(parser.token.span)); } let msg = &e.message[0]; e.message[0] = ( - format!( + rustc_errors::DiagnosticMessage::Str(format!( "macro expansion ends with an incomplete expression: {}", - msg.0.replace(", found `<eof>`", ""), - ), + msg.0.as_str().replace(", found `<eof>`", ""), + )), msg.1, ); } |
