From 1aad320974786f3abbe6e82a9d96d5594238046b Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 19 Feb 2018 10:07:45 -0800 Subject: When encountering invalid token after `unsafe`, mention `{` --- src/libsyntax/parse/parser.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ac582627f88..fed7d25811a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6469,6 +6469,8 @@ impl<'a> Parser<'a> { && self.look_ahead(1, |t| *t != token::OpenDelim(token::Brace)) { // UNSAFE FUNCTION ITEM self.bump(); // `unsafe` + // `{` is also expected after `unsafe`, in case of error, include it in the diagnostic + self.check(&token::OpenDelim(token::Brace)); let abi = if self.eat_keyword(keywords::Extern) { self.parse_opt_abi()?.unwrap_or(Abi::C) } else { -- cgit 1.4.1-3-g733a5