-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Minor improvements to future::join!
's implementation
#91721
Conversation
37adba3
to
df19cfc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
90426af
to
1b6fa2c
Compare
This comment has been minimized.
This comment has been minimized.
This is a follow-up from rust-lang#91645, regarding [some remarks I made](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/join!/near/264293660). Mainly: - it hides the recursive munching through a private `macro`, to avoid leaking such details (a corollary is getting rid of the need to use `@` to disambiguate); - it uses a `match` binding, _outside_ the `async move` block, to better match the semantics from function-like syntax; - it pre-pins the future before calling into `poll_fn`, since `poll_fn`, alone, cannot guarantee that its capture does not move; - it uses `.ready()?` since it's such a neat pattern; - it renames `Took` to `Taken` for consistency with `Done`.
Co-Authored-By: Ibraheem Ahmed <ibrah1440@gmail.com>
1b6fa2c
to
07bcf4a
Compare
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Ibraheem Ahmed <ibrah1440@gmail.com>
8eb42a1
to
c0b8265
Compare
r? @joshtriplett, as discussed over Zulip |
This comment has been minimized.
This comment has been minimized.
c0b8265
to
37f65d1
Compare
This comment has been minimized.
This comment has been minimized.
37f65d1
to
f8dc13d
Compare
@bors r+ |
📌 Commit f8dc13d has been approved by |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
@bors r+ |
📌 Commit 67ab53d has been approved by |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…askrgr Rollup of 6 pull requests Successful merges: - rust-lang#83174 (Suggest using a temporary variable to fix borrowck errors) - rust-lang#89734 (Point at capture points for non-`'static` reference crossing a `yield` point) - rust-lang#90270 (Make `Borrow` and `BorrowMut` impls `const`) - rust-lang#90741 (Const `Option::cloned`) - rust-lang#91548 (Add spin_loop hint for RISC-V architecture) - rust-lang#91721 (Minor improvements to `future::join!`'s implementation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Could this have caused the UB error in https://github.com/rust-lang/miri-test-libstd/runs/4495870835?check_suite_focus=true? |
Zulip discussion about the UB error: https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Cron.20Job.20Failure.202021-12-12 |
As of https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Cron.20Job.20Failure.202021-12-12/near/264707667, I no longer think this PR is to blame. |
This is a follow-up from #91645, regarding some remarks I made.
Mainly:
macro
, to avoid leaking such details (a corollary is getting rid of the need to use@
to disambiguate);match
binding, outside theasync move
block, to better match the semantics from function-like syntax;poll_fn
, sincepoll_fn
, alone, cannot guarantee that its capture does not move (to clarify: I believe the previous code was sound, thanks to the outer layer ofasync
. But I find it clearer / more robust to refactorings this way 🙂)..ready()?
;Took
toTaken
for consistency withDone
(tiny nit 😄).TODODone::value
semantics are respected.r? @nrc