Skip to content

Reject static async closures in AST lowering #145605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 19, 2025
@rustbot

This comment has been minimized.

@compiler-errors
Copy link
Member Author

Rejecting this pre-expansion should be covered by #145604, but I guess we don't necessarily need to parse the combination at all.

@compiler-errors
Copy link
Member Author

Let's see what the fallout is tho.

@bors2 try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 19, 2025
@compiler-errors
Copy link
Member Author

TODO: add a test for static gen || {} too.

@rust-log-analyzer

This comment has been minimized.

@fmease fmease added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 19, 2025
@rust-lang rust-lang deleted a comment from rustbot Aug 19, 2025
@compiler-errors compiler-errors changed the title Reject async closures in AST lowering Reject static async closures in AST lowering Aug 19, 2025
@compiler-errors
Copy link
Member Author

compiler-errors commented Aug 19, 2025

I'll bless the spans when bors is back

@GrigorenkoPV
Copy link
Contributor

GrigorenkoPV commented Aug 19, 2025

I think there is one test in rust-analyzer that this will break too

@fmease
Copy link
Member

fmease commented Aug 19, 2025

I think there is one test in rust-analyzer that this will break too

rust-analyzer doesn't depend on rustc like that, so no, that shouldn't happen.

@rust-bors
Copy link

rust-bors bot commented Aug 19, 2025

☀️ Try build successful (CI)
Build commit: 0e1f5e2 (0e1f5e292c80a395d02835ac656d141e992caf89, parent: 8365fcb2b840c95eeb0bc377af8bd498fad22245)

@compiler-errors
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-145605 created and queued.
🤖 Automatically detected try build 0e1f5e2
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 19, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-145605 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@rustbot
Copy link
Collaborator

rustbot commented Aug 19, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@craterbot
Copy link
Collaborator

🎉 Experiment pr-145605 is completed!
📊 5 regressed and 10 fixed (685389 total)
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Aug 20, 2025
@fmease
Copy link
Member

fmease commented Aug 20, 2025

All spurious as far as I can tell.

Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

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

TODO: add a test for static gen || {} too.

.

but I guess we don't necessarily need to parse the combination at all.

Do you mean rejecting static || {} (and async, gen) in the parser unless it's #[coroutine] static || {}? That'd be quite surprising and also unprecedented if I'm not mistaken (namely, looking through the attributes at parse time), tho I guess it's technically possible since built-in attributes can never be shadowed by user-defined attributes (we reject such cases with ambiguity).


Regarding the 'gen || {} doesn't parse <-> static gen || {} parses and "works"' situation, I guess we want to do that in a separate PR? Esp. if it needs further discussions with oli. E.g, we also parse async gen || {} but bug! during AST lowering. I don't know what the untold plans are for all of these features.


r=me with static gen closure test added unless you also want to address some of the other things I mentioned above in this PR.

@fmease fmease added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2025
@compiler-errors
Copy link
Member Author

Do you mean rejecting static || {} (and async, gen) in the parser unless it's #[coroutine] static || {}?

No, i mean making $KW static || {} illegal, since we don't really have a meaning yet for the combination of the two modifiers on closures yet.

@fmease
Copy link
Member

fmease commented Aug 20, 2025

Ah, sounds good! Let's do that once the results for #145604 are back!

Edit: Results are back and they're clean! Feel free to proceed :)

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.

6 participants