about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorholmgr <viktor.holmgren@gmail.com>2018-10-10 15:34:06 +0200
committerholmgr <viktor.holmgren@gmail.com>2018-10-10 19:39:16 +0200
commit05bb22d9e86bcf4953ad2dbba36fa0adb6ebc859 (patch)
treeb7a9e41ddaf46247e52ca2be62d4c224281c8683 /src/libsyntax/parse
parente1041c6cd1a027ab3ada3e8538620d2e1d7067fe (diff)
downloadrust-05bb22d9e86bcf4953ad2dbba36fa0adb6ebc859.tar.gz
rust-05bb22d9e86bcf4953ad2dbba36fa0adb6ebc859.zip
Remove incorrect span for second label inner macro invocation
Diffstat (limited to 'src/libsyntax/parse')
-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 d653ed819fd..08349084aa6 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");