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

Don't ICE on item in .await expression #62152

Merged
merged 1 commit into from
Jun 28, 2019
Merged

Don't ICE on item in .await expression #62152

merged 1 commit into from
Jun 28, 2019

Conversation

doctorn
Copy link
Contributor

@doctorn doctorn commented Jun 26, 2019

The code for lowering a .await expression missed that item IDs may already have been assigned for items inside of an async block, or for closures. This change means we no longer exit early after finding a .await in a block that isn't async and instead just emit the error. This avoids an ICE generated due to item IDs not being densely generated. (The YieldSource of the generated yield expression is used to avoid errors generated about having yield expressions outside of generator literals.)

r? @cramertj

Resolves #62009 and resolves #61685

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 26, 2019
@doctorn doctorn changed the title Don't ICE on item in await expression Don't ICE on item in .await expression Jun 26, 2019
match self.yield_ty {
Some(ty) => {
self.check_expr_coercable_to_type(&value, ty);
}
None => {
// Given that this `yield` expression was generated as a result of lowering a `.await`,
Copy link
Member

Choose a reason for hiding this comment

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

Cute!

@cramertj
Copy link
Member

@bors r+

Thanks so much!

@bors
Copy link
Contributor

bors commented Jun 26, 2019

📌 Commit 5cb841d has been approved by cramertj

@bors
Copy link
Contributor

bors commented Jun 26, 2019

🌲 The tree is currently closed for pull requests below priority 999, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 26, 2019
Centril added a commit to Centril/rust that referenced this pull request Jun 27, 2019
Don't ICE on item in `.await` expression

The code for lowering a `.await` expression missed that item IDs may already have been assigned for items inside of an `async` block, or for closures. This change means we no longer exit early after finding a `.await` in a block that isn't `async` and instead just emit the error. This avoids an ICE generated due to item IDs not being densely generated. (The `YieldSource` of the generated `yield` expression is  used to avoid errors generated about having `yield` expressions outside of generator literals.)

r? @cramertj

Resolves rust-lang#62009 and resolves rust-lang#61685
Centril added a commit to Centril/rust that referenced this pull request Jun 27, 2019
Don't ICE on item in `.await` expression

The code for lowering a `.await` expression missed that item IDs may already have been assigned for items inside of an `async` block, or for closures. This change means we no longer exit early after finding a `.await` in a block that isn't `async` and instead just emit the error. This avoids an ICE generated due to item IDs not being densely generated. (The `YieldSource` of the generated `yield` expression is  used to avoid errors generated about having `yield` expressions outside of generator literals.)

r? @cramertj

Resolves rust-lang#62009 and resolves rust-lang#61685
Centril added a commit to Centril/rust that referenced this pull request Jun 27, 2019
Don't ICE on item in `.await` expression

The code for lowering a `.await` expression missed that item IDs may already have been assigned for items inside of an `async` block, or for closures. This change means we no longer exit early after finding a `.await` in a block that isn't `async` and instead just emit the error. This avoids an ICE generated due to item IDs not being densely generated. (The `YieldSource` of the generated `yield` expression is  used to avoid errors generated about having `yield` expressions outside of generator literals.)

r? @cramertj

Resolves rust-lang#62009 and resolves rust-lang#61685
Centril added a commit to Centril/rust that referenced this pull request Jun 27, 2019
Don't ICE on item in `.await` expression

The code for lowering a `.await` expression missed that item IDs may already have been assigned for items inside of an `async` block, or for closures. This change means we no longer exit early after finding a `.await` in a block that isn't `async` and instead just emit the error. This avoids an ICE generated due to item IDs not being densely generated. (The `YieldSource` of the generated `yield` expression is  used to avoid errors generated about having `yield` expressions outside of generator literals.)

r? @cramertj

Resolves rust-lang#62009 and resolves rust-lang#61685
bors added a commit that referenced this pull request Jun 28, 2019
Rollup of 16 pull requests

Successful merges:

 - #61878 (improve pinning projection docs)
 - #62043 (Remove `FnBox`)
 - #62067 (Add suggestion for missing `.await` keyword)
 - #62076 (Updated RELEASES.md for 1.36.0)
 - #62102 (call out explicitly that general read needs to be called with an initialized buffer)
 - #62106 (Add more tests for async/await)
 - #62124 (refactor lexer to use idiomatic borrowing)
 - #62131 (libsyntax: Fix some Clippy warnings)
 - #62152 (Don't ICE on item in `.await` expression)
 - #62154 (Remove old fixme)
 - #62155 (Add regression test for MIR drop generation in async loops)
 - #62156 (Update books)
 - #62160 (Remove outdated question_mark_macro_sep lint)
 - #62164 (save-analysis: use buffered writes)
 - #62171 (rustc: Retry SIGILL linker invocations)
 - #62176 (Update RLS)

Failed merges:

r? @ghost
@bors bors merged commit 5cb841d into rust-lang:master Jun 28, 2019
@doctorn doctorn deleted the async_let_ice branch June 28, 2019 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE when playing with async/await. Rustc paniced when apply .await on a closure in a non-async function
5 participants