Skip to content

fix: don't panic on doc comments attached to literal expressions - #23295

Open
Aditya-PS-05 wants to merge 1 commit into
rust-lang:masterfrom
Aditya-PS-05:fix-doc-comment-literal-panic
Open

fix: don't panic on doc comments attached to literal expressions#23295
Aditya-PS-05 wants to merge 1 commit into
rust-lang:masterfrom
Aditya-PS-05:fix-doc-comment-literal-panic

Conversation

@Aditya-PS-05

@Aditya-PS-05 Aditya-PS-05 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

closes #23293

issue was that doc comments trivia changed to DOC_COMMENT nodes (in 143c033). Literal::token() skips only for ATTR and trivia and so panics for DOC_COMMENT (as it's 3rd new type) and so fixed it by checking it.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 4, 2026

@bit-aloo bit-aloo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you also check for other places where we filter things based on whether they are trivia? I am pretty sure this change could have subtle effects elsewhere too, since DOC_COMMENT recently moved to its own node and is no longer considered trivia.

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic: None in crates/syntax/src/ast/expr_ext.rs

3 participants