diff options
| author | bors <bors@rust-lang.org> | 2021-01-22 02:42:38 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-22 02:42:38 +0000 | 
| commit | dc1eee2f256efbd1d3b50b6b090232f81cac6d72 (patch) | |
| tree | 3c4b490d54ce2e526d7ed3958bfd32569dfb75f1 /compiler/rustc_expand/src/proc_macro.rs | |
| parent | a9a396d8ed0244ba8bb3fe1793ae2a6fdabd7754 (diff) | |
| parent | 11b1e370161dd09c095350c66f7b187fc9654ec6 (diff) | |
| download | rust-dc1eee2f256efbd1d3b50b6b090232f81cac6d72.tar.gz rust-dc1eee2f256efbd1d3b50b6b090232f81cac6d72.zip | |
Auto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkov
Force token collection to run when parsing nonterminals Fixes #81007 Previously, we would fail to collect tokens in the proper place when only builtin attributes were present. As a result, we would end up with attribute tokens in the collected `TokenStream`, leading to duplication when we attempted to prepend the attributes from the AST node. We now explicitly track when token collection must be performed due to nomterminal parsing.
Diffstat (limited to 'compiler/rustc_expand/src/proc_macro.rs')
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro.rs | 3 | 
1 files changed, 2 insertions, 1 deletions
| diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs index 02129e9b5e5..6779734cfc1 100644 --- a/compiler/rustc_expand/src/proc_macro.rs +++ b/compiler/rustc_expand/src/proc_macro.rs @@ -9,6 +9,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{struct_span_err, Applicability, ErrorReported}; use rustc_lexer::is_ident; use rustc_parse::nt_to_tokenstream; +use rustc_parse::parser::ForceCollect; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; @@ -117,7 +118,7 @@ impl MultiItemModifier for ProcMacroDerive { let mut items = vec![]; loop { - match parser.parse_item() { + match parser.parse_item(ForceCollect::No) { Ok(None) => break, Ok(Some(item)) => { if is_stmt { | 
