diff options
| author | kennytm <kennytm@gmail.com> | 2018-06-22 16:50:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-22 16:50:41 +0800 |
| commit | aa3a6273af45019d4e60eeed9798db69840e26e4 (patch) | |
| tree | 83c8a3471e3c804943f9af24b71a99a668f5119a /src/libsyntax | |
| parent | 8ef9e2c260647ca58d5ad80affd5b09184b87dc1 (diff) | |
| parent | cafe9d0ed404e940a1f039e25053f11f47e88973 (diff) | |
| download | rust-aa3a6273af45019d4e60eeed9798db69840e26e4.tar.gz rust-aa3a6273af45019d4e60eeed9798db69840e26e4.zip | |
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.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3955ccb4c42..2408d6202d8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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])?; } } _ => {} |
