Rollup merge of #51629 - topecongiro:multiple-semicolon-in-local-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 https://github.com/rust-lang-nursery/rustfmt/issues/2791.
This commit is contained in:
kennytm 2018-06-22 16:50:41 +08:00 committed by GitHub
commit aa3a6273af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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])?;
}
}
_ => {}