Skip to content

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

Merged
bors merged 1 commit into
rust-lang:masterfrom
cofibrant:async_let_ice
Jun 28, 2019
Merged

Don't ICE on item in .await expression#62152
bors merged 1 commit into
rust-lang:masterfrom
cofibrant:async_let_ice

Conversation

@cofibrant

@cofibrantcofibrant commented Jun 26, 2019

Copy link
Copy Markdown
Contributor

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-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 26, 2019
@cofibrantcofibrant changed the title Don't ICE on item in await expressionDon't ICE on item in .await expressionJun 26, 2019
Comment threadsrc/librustc_typeck/check/expr.rs Outdated
Comment threadsrc/librustc_typeck/check/expr.rs
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
Copy Markdown
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
Copy Markdown
Member

@bors r+

Thanks so much!

@bors

bors commented Jun 26, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 5cb841d has been approved by cramertj

@bors

bors commented Jun 26, 2019

Copy link
Copy Markdown
Collaborator

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

@borsbors 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? @cramertjResolvesrust-lang#62009 and resolvesrust-lang#61685
@CentrilCentril mentioned this pull request Jun 27, 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? @cramertjResolvesrust-lang#62009 and resolvesrust-lang#61685
@CentrilCentril mentioned this pull request Jun 27, 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? @cramertjResolvesrust-lang#62009 and resolvesrust-lang#61685
@CentrilCentril mentioned this pull request Jun 27, 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? @cramertjResolvesrust-lang#62009 and resolvesrust-lang#61685
@CentrilCentril mentioned this pull request Jun 27, 2019
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:masterJun 28, 2019
@cofibrant
cofibrant deleted the async_let_ice branch June 28, 2019 17:40
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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

@cofibrant@cramertj@bors@Centril@rust-highfive