about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-27 15:03:58 +0200
committerGitHub <noreply@github.com>2022-10-27 15:03:58 +0200
commitf9dfb6e32fdb2642b5c4b366f3bd5f0bbc25f411 (patch)
tree2a572748ffc640ba59c5752041b97d090e25e8f5 /compiler/rustc_parse/src/parser/expr.rs
parent4a01cab4b7ae190800e577bf40c97c9bcb29e901 (diff)
parentda407ed38f6bcb79683379d59d18e615d2b8dfaa (diff)
downloadrust-f9dfb6e32fdb2642b5c4b366f3bd5f0bbc25f411.tar.gz
rust-f9dfb6e32fdb2642b5c4b366f3bd5f0bbc25f411.zip
Rollup merge of #103544 - Nilstrieb:no-recovery-pls, r=compiler-errors
Add flag to forbid recovery in the parser

To start the effort of fixing #103534, this adds a new flag to the parser, which forbids the parser from doing recovery, which it shouldn't do in macros.

This doesn't add any new checks for recoveries yet and is just here to bikeshed the names for the functions here before doing more.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index ca216b1cd10..a781748efc5 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2112,6 +2112,8 @@ impl<'a> Parser<'a> {
             // 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.may_recover()
+            // FIXME(Nilstrieb): Remove this check once `may_recover` actually stops recovery
             && self.subparser_name.is_none()
         {
             // It is likely that the closure body is a block but where the