Skip to content

Recover on attribute in use tree#155254

Draft
scrabsha wants to merge 2 commits intorust-lang:mainfrom
scrabsha:push-qlmmuuwqnoqv
Draft

Recover on attribute in use tree#155254
scrabsha wants to merge 2 commits intorust-lang:mainfrom
scrabsha:push-qlmmuuwqnoqv

Conversation

@scrabsha
Copy link
Copy Markdown
Contributor

@scrabsha scrabsha commented Apr 13, 2026

Renders as:

This requires passing two more arguments to Parser::parse_use_tree and I'm not super happy about it. I did consider adding more context to Parser instead, but that did not sound like a good idea. Happy to rework my code to make it less ugly :)

I am also not very happy that the deletion shows up as a green ~ in the suggestion. I tried very hard to make it render properly but failed. I am not sure it's actually possible but would love to be proven wrong hehe

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 13, 2026
@rust-log-analyzer

This comment has been minimized.

@scrabsha scrabsha force-pushed the push-qlmmuuwqnoqv branch from 291ff75 to 290c04c Compare April 13, 2026 19:54
/// Consumes the tokens that constitute the attribute and returns them.
///
/// /!\ Always emit an error if this function returns `Some(_)`.
fn recover_attr_in_use_tree(&mut self) -> Option<Span> {
Copy link
Copy Markdown
Member

@fmease fmease Apr 13, 2026

Choose a reason for hiding this comment

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

View changes since the review

Is there any particular reason for why you don't just call the attribute subparsers directly and reject the attributes immediately after? There shouldn't be any issue with that like ambiguities or what have you.

Right now you're essentially reimplementing parts of the attribute parser.

E.g., for types & generic arguments where attributes are also not allowed, we just use the attribute subparsers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh, good idea. thanks! i'll do that tomorrow

(note for tomorrow me: the logic is the same as Parser::parse_generic_arg)

@scrabsha scrabsha force-pushed the push-qlmmuuwqnoqv branch from 290c04c to 83f6ae9 Compare April 14, 2026 20:11
@scrabsha
Copy link
Copy Markdown
Contributor Author

@fmease would you be ok with me assigning this PR to you? (once I have re-reviewed it again)

@fmease
Copy link
Copy Markdown
Member

fmease commented Apr 14, 2026

Sure! :)

@fmease fmease self-assigned this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants