diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 436e0b53a76..4deeb4a43d9 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1044,7 +1044,9 @@ pub fn ensure_complete_parse(&mut self, macro_path: &Path, kind_name: &str, span ); err.note(&msg); let semi_span = self.sess.source_map().next_point(span); - match self.sess.source_map().span_to_snippet(semi_span) { + + let semi_full_span = semi_span.to(self.sess.source_map().next_point(semi_span)); + match self.sess.source_map().span_to_snippet(semi_full_span) { Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => { err.span_suggestion_with_applicability( semi_span, diff --git a/src/test/ui/macros/macro-context.stderr b/src/test/ui/macros/macro-context.stderr index 5ea7825080c..005e1d1c8e7 100644 --- a/src/test/ui/macros/macro-context.stderr +++ b/src/test/ui/macros/macro-context.stderr @@ -16,9 +16,7 @@ LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved k | ^^^^^^ ... LL | let i = m!(); - | ----- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here + | ---- caused by the macro expansion here | = note: the usage of `m!` is likely invalid in expression context