Skip to content
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

feat: Implement diagnostic for await outside of async #17791

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

ShoyuVanilla
Copy link
Member

Closes #17781

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2024
@@ -100,6 +101,8 @@ struct ExprCollector<'a> {
// resolution
label_ribs: Vec<LabelRib>,
current_binding_owner: Option<ExprId>,

awaitable_blocks: Vec<Awaitable>,
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, an Option<Awaitable> should suffice here, which would be replaced with coroutine_kind after #16173. In fact you can probably take a peek at how that PR sets coroutine_kind. Mihgt be simple enough to copy if the changes aren't drastic in there.

Then we just need to swap whenever we enter and exit a context like we do with other Option/bool things here

@Veykril
Copy link
Member

Veykril commented Aug 5, 2024

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Aug 5, 2024

📌 Commit 8a51419 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 5, 2024

⌛ Testing commit 8a51419 with merge 25d9e05...

@bors
Copy link
Contributor

bors commented Aug 5, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 25d9e05 to master...

@bors bors merged commit 25d9e05 into rust-lang:master Aug 5, 2024
11 checks passed
@ShoyuVanilla ShoyuVanilla deleted the await-outside-of-async branch August 17, 2024 12:55
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.

Diagnose await outside async context
4 participants