Skip to content

Commit

Permalink
Rollup merge of rust-lang#54967 - holmgr:master, r=estebank
Browse files Browse the repository at this point in the history
Remove incorrect span for second label inner macro invocation

A fix for issue rust-lang#54841
  • Loading branch information
Mark-Simulacrum authored Oct 11, 2018
2 parents dc62e1d + 05bb22d commit e5ed251
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 0 additions & 3 deletions src/test/ui/macros/issue-54441.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
error: expected one of `crate`, `fn`, `pub`, `static`, or `type`, found `let`
--> $DIR/issue-54441.rs:5:9
|
LL | #![feature(macros_in_extern)]
| - expected one of `crate`, `fn`, `pub`, `static`, or `type` here
...
LL | let //~ ERROR expected
| ^^^ unexpected token
...
Expand Down

0 comments on commit e5ed251

Please sign in to comment.