1
Github parser: Ensure that all nonterminals have tokens after parsing by petroch...
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.
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{}
, orpath + 1
) becausefn parse_stmt_without_recovery
forgot to propagateforce_collect
in some cases.expr
nonterminal with expressions with built-in attributes (e.g.#[allow(warnings)] 0
) due to an incorrect optimization infn 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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK