Skip to content

Commit

Permalink
Fix span bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Feb 9, 2018
1 parent 932c736 commit 4d92fe2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2630,8 +2630,7 @@ impl<'a> Parser<'a> {
// A tuple index may not have a suffix
self.expect_no_suffix(sp, "tuple index", suf);

let dot_span = self.prev_span;
hi = self.span;
let idx_span = self.span;
self.bump();

let invalid_msg = "invalid tuple or struct index";
Expand All @@ -2646,9 +2645,8 @@ impl<'a> Parser<'a> {
n.to_string());
err.emit();
}
let id = respan(dot_span.to(hi), n);
let field = self.mk_tup_field(e, id);
e = self.mk_expr(lo.to(hi), field, ThinVec::new());
let field = self.mk_tup_field(e, respan(idx_span, n));
e = self.mk_expr(lo.to(idx_span), field, ThinVec::new());
}
None => {
let prev_span = self.prev_span;
Expand Down

0 comments on commit 4d92fe2

Please sign in to comment.