about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser/stmt.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-15 00:32:05 +0000
committerbors <bors@rust-lang.org>2019-08-15 00:32:05 +0000
commit9e9a136fcec5eb78f09a14dfd072a51ae2550269 (patch)
treeb193fe082d78583740df368de6f546ca35890cbb /src/libsyntax/parse/parser/stmt.rs
parent082cf2f9d136166cd1d552d3fb5abb1c46c99a14 (diff)
parent78cd9d1fd5cd59fbab62325b1bcb4bb21c2cb30a (diff)
downloadrust-9e9a136fcec5eb78f09a14dfd072a51ae2550269.tar.gz
rust-9e9a136fcec5eb78f09a14dfd072a51ae2550269.zip
Auto merge of #63575 - Centril:rollup-anlv9g5, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #62984 (Add lint for excess trailing semicolons)
 - #63075 (Miri: Check that a ptr is aligned and inbounds already when evaluating `*`)
 - #63490 (libsyntax: cleanup and refactor `pat.rs`)
 - #63507 (When needing type annotations in local bindings, account for impl Trait and closures)
 - #63509 (Point at the right enclosing scope when using `await` in non-async fn)
 - #63528 (syntax: Remove `DummyResult::expr_only`)
 - #63537 (expand: Unimplement `MutVisitor` on `MacroExpander`)
 - #63542 (Add NodeId for Arm, Field and FieldPat)
 - #63543 (Merge Variant and Variant_)
 - #63560 (move test that shouldn't be in test/run-pass/)
 - #63570 (Adjust tracking issues for `MaybeUninit<T>` gates)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse/parser/stmt.rs')
-rw-r--r--src/libsyntax/parse/parser/stmt.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser/stmt.rs b/src/libsyntax/parse/parser/stmt.rs
index f182edcbff4..750d8fbbddc 100644
--- a/src/libsyntax/parse/parser/stmt.rs
+++ b/src/libsyntax/parse/parser/stmt.rs
@@ -167,7 +167,22 @@ impl<'a> Parser<'a> {
                     if self.token == token::Semi {
                         unused_attrs(&attrs, self);
                         self.bump();
-                        return Ok(None);
+                        let mut last_semi = lo;
+                        while self.token == token::Semi {
+                            last_semi = self.token.span;
+                            self.bump();
+                        }
+                        // We are encoding a string of semicolons as an
+                        // an empty tuple that spans the excess semicolons
+                        // to preserve this info until the lint stage
+                        return Ok(Some(Stmt {
+                            id: ast::DUMMY_NODE_ID,
+                            span: lo.to(last_semi),
+                            node: StmtKind::Semi(self.mk_expr(lo.to(last_semi),
+                                ExprKind::Tup(Vec::new()),
+                                ThinVec::new()
+                            )),
+                        }));
                     }
 
                     if self.token == token::CloseDelim(token::Brace) {