Don't erroneously deny semicolons after closure expr within parentheses in a macro

This commit is contained in:
Michael Goulet 2022-10-19 04:55:31 +00:00
parent eecde5850c
commit 3d7b1f0d18
2 changed files with 18 additions and 0 deletions

View file

@ -2051,6 +2051,10 @@ impl<'a> Parser<'a> {
if self.token.kind == TokenKind::Semi
&& matches!(self.token_cursor.frame.delim_sp, Some((Delimiter::Parenthesis, _)))
// HACK: This is needed so we can detect whether we're inside a macro,
// where regular assumptions about what tokens can follow other tokens
// don't necessarily apply.
&& self.subparser_name.is_none()
{
// It is likely that the closure body is a block but where the
// braces have been removed. We will recover and eat the next