Minor improvements to future::join!'s implementation#91721
Minor improvements to future::join!'s implementation#91721bors merged 6 commits intorust-lang:masterfrom
future::join!'s implementation#91721Conversation
37adba3 to
df19cfc
Compare
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);matchbinding, outside theasync moveblock, 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()?;TooktoTakenfor consistency withDone(tiny nit 😄).TODODone::valuesemantics are respected.r? @nrc