Skip to content

Commit

Permalink
Rollup merge of rust-lang#51629 - topecongiro:multiple-semicolon-in-l…
Browse files Browse the repository at this point in the history
…ocal-span, r=petrochenkov

Do not consume semicolon twice while parsing local statement

The span for a `let` statement includes multiple semicolons. For example,

```rust
    let x = 2;;;
//  ^^^^^^^^^^^ The span for the above statement.
```

This PR fixes it.

cc rust-lang/rustfmt#2791.
  • Loading branch information
kennytm authored Jun 22, 2018
2 parents 8ef9e2c + cafe9d0 commit aa3a627
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ impl<'a> Parser<'a> {
if macro_legacy_warnings && self.token != token::Semi {
self.warn_missing_semicolon();
} else {
self.expect_one_of(&[token::Semi], &[])?;
self.expect_one_of(&[], &[token::Semi])?;
}
}
_ => {}
Expand Down

0 comments on commit aa3a627

Please sign in to comment.