Rollup merge of #48356 - estebank:unsafe-without-braces, r=nikomatsakis
When encountering invalid token after `unsafe`, mention `{` Fix #37158.
This commit is contained in:
commit
fc7caed04e
3 changed files with 28 additions and 0 deletions
|
@ -6482,6 +6482,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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue