Skip to content

Restore impl Future<Output = Type> to async blocks #95263

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Mar 24, 2022

I was sad when I undid some of the code I wrote in #91096 in the PR #95225, so I fixed it here to not print [async output].

This PR "manually" normalizes the associated type <[generator] as Generator>::Return type which appears very frequently in impl Future types that result from async block desugaring.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 24, 2022
@rust-highfive
Copy link
Contributor

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 24, 2022
@bors
Copy link
Collaborator

bors commented Mar 30, 2022

☔ The latest upstream changes (presumably #94081) made this pull request unmergeable. Please resolve the merge conflicts.

Comment on lines +912 to +916
// Skip printing `<[generator@] as Generator<_>>::Return` from async blocks,
// unless we can find out what generator return type it comes from.
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to say the inverse of what it should say

Suggested change
// Skip printing `<[generator@] as Generator<_>>::Return` from async blocks,
// unless we can find out what generator return type it comes from.
// Skip printing `<[generator@] as Generator<_>>::Return` from async blocks
// if we can find out what generator return type it comes from.

Copy link
Member Author

@compiler-errors compiler-errors Mar 30, 2022

Choose a reason for hiding this comment

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

Maybe our perspectives are inverted -- so it does two things, 1. skips printing <[generator@] as Generator<_>>::Return regardless, but 2. will instead print Output=Type if it can find the return type. If it can't, it skips printing altogether.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, then the comment makes sense 👍🏼

@jackh726
Copy link
Member

r=me after rebase

@compiler-errors
Copy link
Member Author

@bors r=jackh726

@bors
Copy link
Collaborator

bors commented Mar 31, 2022

📌 Commit 7b2eaa3 has been approved by jackh726

@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 Mar 31, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 31, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#95130 (Stabilize thread::is_finished)
 - rust-lang#95263 (Restore `impl Future<Output = Type>` to async blocks)
 - rust-lang#95471 (Don't ICE when opaque types get their hidden type constrained again.)
 - rust-lang#95491 (Stabilize feature vec_retain_mut on Vec and VecDeque)
 - rust-lang#95497 (Spellchecking compiler comments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Mar 31, 2022

☔ The latest upstream changes (presumably #95506) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors merged commit 4ce6567 into rust-lang:master Mar 31, 2022
@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 31, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 31, 2022
@compiler-errors compiler-errors deleted the async-block-pretty branch April 7, 2022 04:30
# for free to join this conversation on GitHub. Already have an account? # 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