about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-10-19 04:55:31 +0000
committerMichael Goulet <michael@errs.io>2022-10-22 06:59:49 +0000
commit3d7b1f0d18a4bdb667c6244b1748136c312cc9cf (patch)
tree8c2eab6069abe6487d444644a8777c32b488bfad /compiler/rustc_parse/src/parser/expr.rs
parenteecde5850cade0c058dc12330081329b31a826c7 (diff)
downloadrust-3d7b1f0d18a4bdb667c6244b1748136c312cc9cf.tar.gz
rust-3d7b1f0d18a4bdb667c6244b1748136c312cc9cf.zip
Don't erroneously deny semicolons after closure expr within parentheses in a macro
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index afa116ce1bc..5b466cec8e1 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -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