about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-12 23:37:39 +0000
committerbors <bors@rust-lang.org>2019-07-12 23:37:39 +0000
commite13fe7ff5e482b626714ac6ec41b8d44e7c22ed1 (patch)
treea060f5b049425798bdf7dc8470ae34c4e7e5b22b /src/libsyntax/parse/parser.rs
parent71f9384e3bec467158a628e2d11e77ffada16a90 (diff)
parentfe4e32a4e655846976475ef0a7dc5837eab796fe (diff)
downloadrust-e13fe7ff5e482b626714ac6ec41b8d44e7c22ed1.tar.gz
rust-e13fe7ff5e482b626714ac6ec41b8d44e7c22ed1.zip
Auto merge of #62635 - Centril:rollup-potvfnk, r=Centril
Rollup of 12 pull requests

Successful merges:

 - #61535 (Coherence test when a generic type param has a default value from an associated type)
 - #62274 (rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.)
 - #62431 (Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*`)
 - #62453 (in which we suggest anonymizing single-use lifetimes in paths )
 - #62568 (Replace unsafe_destructor_blind_to_params with may_dangle)
 - #62578 (Add test for #49919)
 - #62595 (Document that the crate keyword refers to the project root)
 - #62599 (move mem::uninitialized deprecation back by 1 release, to 1.39)
 - #62605 (Emit dropped unemitted errors to aid in ICE debugging)
 - #62607 (Correctly break out of recovery loop)
 - #62608 (`async unsafe fn` tests)
 - #62623 (downgrade indirect_structural_match lint to allow)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 83dbff6b2d5..e0633f73ac4 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4629,6 +4629,9 @@ impl<'a> Parser<'a> {
     fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
         let mut stmts = vec![];
         while !self.eat(&token::CloseDelim(token::Brace)) {
+            if self.token == token::Eof {
+                break;
+            }
             let stmt = match self.parse_full_stmt(false) {
                 Err(mut err) => {
                     err.emit();
@@ -4643,8 +4646,6 @@ impl<'a> Parser<'a> {
             };
             if let Some(stmt) = stmt {
                 stmts.push(stmt);
-            } else if self.token == token::Eof {
-                break;
             } else {
                 // Found only `;` or `}`.
                 continue;
@@ -6666,12 +6667,13 @@ impl<'a> Parser<'a> {
     }
 
     /// Reads a module from a source file.
-    fn eval_src_mod(&mut self,
-                    path: PathBuf,
-                    directory_ownership: DirectoryOwnership,
-                    name: String,
-                    id_sp: Span)
-                    -> PResult<'a, (ast::Mod, Vec<Attribute> )> {
+    fn eval_src_mod(
+        &mut self,
+        path: PathBuf,
+        directory_ownership: DirectoryOwnership,
+        name: String,
+        id_sp: Span,
+    ) -> PResult<'a, (ast::Mod, Vec<Attribute>)> {
         let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
         if let Some(i) = included_mod_stack.iter().position(|p| *p == path) {
             let mut err = String::from("circular modules: ");