From 30b779f3984fa41a54f30c78bd4559233b4e3c4a Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Fri, 19 Apr 2019 11:04:41 -0700 Subject: Remove assumption from recovery code --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a5adb37f745..cc854e938ff 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8366,11 +8366,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, -- cgit 1.4.1-3-g733a5