Skip to content

Commit

Permalink
Rollup merge of #104608 - Nilstrieb:fixmed, r=compiler-errors
Browse files Browse the repository at this point in the history
Cleanup macro matching recovery

The retry has been implemented already in #104335. Also removes a `HACK` comment that's not really needed anymore because the "don't recover during macro matching" isn't really a hack but correct behavior.
  • Loading branch information
Yuki Okushi authored Nov 20, 2022
2 parents 3e937d0 + 825b8db commit 28034bb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ fn try_match_macro<'matcher, T: Tracker<'matcher>>(
// hacky, but speeds up the `html5ever` benchmark significantly. (Issue
// 68836 suggests a more comprehensive but more complex change to deal with
// this situation.)
// FIXME(Nilstrieb): Stop recovery from happening on this parser and retry later with recovery if the macro failed to match.
let parser = parser_from_cx(sess, arg.clone(), T::recovery());
// Try each arm's matchers.
let mut tt_parser = TtParser::new(name);
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2078,12 +2078,7 @@ 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.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
// braces have been removed. We will recover and eat the next
Expand Down

0 comments on commit 28034bb

Please sign in to comment.