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-04-21 10:13:27 +0000
committerbors <bors@rust-lang.org>2019-04-21 10:13:27 +0000
commit06a271a6eb5521d50cbe20a782a20e7c993e7725 (patch)
tree2248e2040c4e7338c2c49345a3c08933c501db44 /src/libsyntax/parse/parser.rs
parent4d9c6cd7226e1839a195f1b6e7d40a3ccf9bb062 (diff)
parent30b779f3984fa41a54f30c78bd4559233b4e3c4a (diff)
downloadrust-06a271a6eb5521d50cbe20a782a20e7c993e7725.tar.gz
rust-06a271a6eb5521d50cbe20a782a20e7c993e7725.zip
Auto merge of #60119 - estebank:bad-recovery, r=davidtwco
Remove assumption from recovery code

Fix #60115.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 29d2d2ad73d..8d2beaa69dd 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8414,11 +8414,11 @@ impl<'a> Parser<'a> {
                 } else {
                     ("fn` or `struct", "function or struct", true)
                 };
-                self.consume_block(token::Brace);
 
                 let msg = format!("missing `{}` for {} definition", kw, kw_name);
                 let mut err = self.diagnostic().struct_span_err(sp, &msg);
                 if !ambiguous {
+                    self.consume_block(token::Brace);
                     let suggestion = format!("add `{}` here to parse `{}` as a public {}",
                                              kw,
                                              ident,