rust/compiler/rustc_ast/src
bors 86b0bafbf1 Auto merge of #84995 - petrochenkov:tcollect, r=Aaron1011
parser: Ensure that all nonterminals have tokens after parsing

`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 https://github.com/rust-lang/rust/pull/83824#issuecomment-817317170.)

r? `@Aaron1011`
2021-06-06 14:00:43 +00:00
..
ast mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
attr Implement token-based handling of attributes during expansion 2021-04-11 01:31:36 -04:00
expand Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
util Remove unnecessary manual shrink_to_fit calls 2021-01-16 14:02:36 +01:00
ast_like.rs parser: Ensure that all nonterminals have tokens after parsing 2021-06-06 14:21:12 +03:00
ast.rs Implement Anonymous{Struct, Union} in the AST 2021-05-16 09:49:16 -05:00
entry.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
lib.rs Remove unused feature gates 2021-05-31 13:55:43 +02:00
mut_visit.rs Implement Anonymous{Struct, Union} in the AST 2021-05-16 09:49:16 -05:00
node_id.rs Clarify docs for DUMMY_NODE_ID 2021-02-07 19:42:12 -08:00
ptr.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
token.rs remove pat2021 2021-04-27 21:15:59 -05:00
tokenstream.rs don't clone attrs 2021-05-30 22:44:40 +03:00
visit.rs Implement Anonymous{Struct, Union} in the AST 2021-05-16 09:49:16 -05:00