-
Notifications
You must be signed in to change notification settings - Fork 633
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
Update to new futures_api #1514
Conversation
3fa1ec0
to
1c646d9
Compare
2fe2457
to
c2249c7
Compare
Is there an ETA when we could land this? The changes have landed in the latest nightly, and currently a good amount of packages are broken until we can land this. |
(Landing it now does not mean that we can immediately release the next version.) |
Also, rust-lang/rust#59733 is already approved, so It will break again in a few days. |
Possibly a ignorant question, but would this fix land (pending time/availability from people, naturally) when/if rust-lang/rust@df25d79 is part of a nightly release? |
Updating to nightly today still gave me another error:
Not entirely sure that this should be dealt with in this pull request, but I think it's because of the waker by ref last minute changes before stabelization. Cloning it here was my fast braindead fix, but I don't know whether that's the best way to solve this. |
@najamelan See 265ca12. |
@taiki-e Oh, sorry, you're awesome. I had missed the extra commit... compiles fine. Thanks |
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.
Looks great, thanks for updating this all.
Everything except the one comment I've left looks like a straight-forward update of the API, there's potentially some performance optimization that could be done using the by-value waking, but that would be best as a separate PR.
futures-util/src/task/arc_wake.rs
Outdated
/// This function is similar to `wake`, but must not consume the provided data | ||
/// pointer. | ||
fn wake_by_ref(arc_self: &Arc<Self>) { | ||
arc_self.clone().wake() |
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.
I'm not certain whether it makes sense to keep the separation of waking by-value and by-ref for ArcWake
, it looks like every implementation of ArcWake::wake
delegates to ArcWake::wake_by_ref
. But maybe the thread pool implementation can be updated to take advantage of it.
I think it makes more sense to provide the ArcWake::wake
implementation as delegating to ArcWake::wake_by_ref
, that would allow dropping all the current delegating implementations, and means that implementors wouldn't accidentally cause an unnecessary clone by only implementing ArcWake::wake
(they may still cause an unnecessary clone by only implementing ArcWake::wake_by_ref
and not taking advantage of being able to reuse the Arc
in ArcWake::wake
, but that seems like a more obvious performance issue since the clone will be happening in their code instead of the provided method).
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.
I think it makes more sense to provide the
ArcWake::wake
implementation as delegating toArcWake::wake_by_ref
, that would allow dropping all the current delegating implementations, and means that implementors wouldn't accidentally cause an unnecessary clone by only implementingArcWake::wake
(they may still cause an unnecessary clone by only implementingArcWake::wake_by_ref
and not taking advantage of being able to reuse theArc
inArcWake::wake
, but that seems like a more obvious performance issue since the clone will be happening in their code instead of the provided method).
Thanks for pointing that out, that makes a lot of sense.
(for others that want to start experimenting off this, here's a block you can copy-paste into your [patch.crates-io]
futures-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-core-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-util-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-sink-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-channel-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-executor-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-io-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" }
futures-test-preview = { git = "https://github.com/taiki-e/futures-rs", branch = "futures_api" } |
Thanks again ❤️, hopefully we can get a release out soon with these fixes in (maybe even one worth promoting to |
Thanks for working to get this landed! All the help is extremely appreciated. I'll get a new release out ASAP. |
@vorot93 merged! :) (In the future, cc'ing me or adding me as a reviewer will get my attention quicker, though I try to scan the repo for PRs every once in a while) |
This PR covers changes by rust-lang/rust#59119 and rust-lang/rust#59733.
cc #1518 (I initially intended to close it with this PR, but in fact it might be better to close it when the next version is released.)