Skip to content

Desugar yield in async gen correctly, ensure gen always returns unit #119061

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

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

compiler-errors
Copy link
Member

  1. Ensure async gen blocks desugar yield $expr to task_context = yield async_gen_ready($expr). Previously we were not assigning the task_context correctly, meaning that yield expressions in async generators returned type ResumeTy instead of (), and that we were not storing the task_context (which is probably unsound if we were reading the old task-context which has an invalidated borrow or something...)
  2. Ensure that all (async?) gen blocks and (async?) gen fns return unit. Previously we were only checking this for gen fn, meaning that gen {} and async gen {} and async gen fn were allowed to return values that weren't unit. This is why [ICE]: assertion left == right failed, left: std::future::ResumeTy, right: () #119058 was an ICE rather than an E0308.

Fixes #119058.

@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 18, 2023
@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 19, 2023

📌 Commit 0f10acf has been approved by wesleywiser

It is now in the queue for this repository.

@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 Dec 19, 2023
@bors
Copy link
Collaborator

bors commented Dec 19, 2023

⌛ Testing commit 0f10acf with merge 59096cd...

@bors
Copy link
Collaborator

bors commented Dec 19, 2023

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing 59096cd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 19, 2023
@bors bors merged commit 59096cd into rust-lang:master Dec 19, 2023
@rustbot rustbot added this to the 1.76.0 milestone Dec 19, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (59096cd): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.1% [4.1%, 4.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.7%, -0.6%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-0.7%, 4.1%] 3

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.6%, -0.5%] 2
Improvements ✅
(secondary)
-2.9% [-3.1%, -2.7%] 2
All ❌✅ (primary) -0.2% [-0.6%, 0.5%] 3

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.4% [0.4%, 0.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.4%, 0.4%] 1

Bootstrap: 673.568s -> 672.298s (-0.19%)
Artifact size: 312.47 MiB -> 312.49 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

[ICE]: assertion left == right failed, left: std::future::ResumeTy, right: ()
5 participants