Skip to content

Commit 2be935d

Browse files
committed
Force token collection to run when parsing nonterminals
Fixes rust-lang#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.
1 parent 9009f8f commit 2be935d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/doc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use rustc_lint::{LateContext, LateLintPass};
1212
use rustc_middle::lint::in_external_macro;
1313
use rustc_middle::ty;
1414
use rustc_parse::maybe_new_parser_from_source_str;
15+
use rustc_parse::parser::ForceCollect;
1516
use rustc_session::parse::ParseSess;
1617
use rustc_session::{declare_tool_lint, impl_lint_pass};
1718
use rustc_span::edition::Edition;
@@ -483,7 +484,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
483484

484485
let mut relevant_main_found = false;
485486
loop {
486-
match parser.parse_item() {
487+
match parser.parse_item(ForceCollect::No) {
487488
Ok(Some(item)) => match &item.kind {
488489
// Tests with one of these items are ignored
489490
ItemKind::Static(..)

0 commit comments

Comments
 (0)