about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-10-12 22:04:16 +0800
committerGitHub <noreply@github.com>2018-10-12 22:04:16 +0800
commit644dbf99edf1b59e3b820bc14ea849c6505e3945 (patch)
tree7812e3b323246561b3345156945e555e92de0d56 /src/libsyntax
parent0187e81da97df00610ab8138bae682678efe9c1b (diff)
parent05bb22d9e86bcf4953ad2dbba36fa0adb6ebc859 (diff)
downloadrust-644dbf99edf1b59e3b820bc14ea849c6505e3945.tar.gz
rust-644dbf99edf1b59e3b820bc14ea849c6505e3945.zip
Rollup merge of #54967 - holmgr:master, r=estebank
Remove incorrect span for second label inner macro invocation

A fix for issue #54841
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 6c375799c38..b5896f37c00 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -772,6 +772,11 @@ impl<'a> Parser<'a> {
                     //   |                   expected one of 8 possible tokens here
                     err.span_label(self.span, label_exp);
                 }
+                _ if self.prev_span == syntax_pos::DUMMY_SP => {
+                    // Account for macro context where the previous span might not be
+                    // available to avoid incorrect output (#54841).
+                    err.span_label(self.span, "unexpected token");
+                }
                 _ => {
                     err.span_label(sp, label_exp);
                     err.span_label(self.span, "unexpected token");