1

Github parser: Ensure that all nonterminals have tokens after parsing by petroch...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/84995
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

petrochenkov commented on May 6

edited

parse_nonterminal should always result in something with tokens.

This requirement wasn't satisfied in two cases:

  • stmt nonterminal with expression statements (e.g. 0, or {}, or path + 1) because fn parse_stmt_without_recovery forgot to propagate force_collect in some cases.
  • expr nonterminal with expressions with built-in attributes (e.g. #[allow(warnings)] 0) due to an incorrect optimization in fn parse_expr_force_collect, it assumed that all expressions starting with # have their tokens collected during parsing, but that's not true if all the attributes on that expression are built-in and inert.

(Discovered when trying to implement eager cfg expansion for all attributes #83824 (comment).)

r? @Aaron1011


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK