about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-10-24 12:52:24 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-10-24 12:52:24 -0700
commitf8818cbf8fc30ac626b2a0a306736c1293257209 (patch)
tree79867c8134c9e665eaba5dc04b4e987ae0bcfd12
parentad144ac3c1da0d4a25d8ca95113ac6f29bc0fce5 (diff)
downloadrust-f8818cbf8fc30ac626b2a0a306736c1293257209.tar.gz
rust-f8818cbf8fc30ac626b2a0a306736c1293257209.zip
Fix incorrect semicolon suggestion
-rw-r--r--src/libsyntax/ext/expand.rs4
-rw-r--r--src/test/ui/macros/macro-context.stderr4
2 files changed, 4 insertions, 4 deletions
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 @@ impl<'a> Parser<'a> {
             );
             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