-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Stabilize the Wake trait #74304
Stabilize the Wake trait #74304
Conversation
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
Updated with @Aaron1011's feedback! |
…ark-Simulacrum Remove unnecessary type hints from Wake internals While working on rust-lang#74304 I noticed we were writing out the type signature twice in some internal `Wake` impl methods; this streamlines that. Thanks!
…ark-Simulacrum Remove unnecessary type hints from Wake internals While working on rust-lang#74304 I noticed we were writing out the type signature twice in some internal `Wake` impl methods; this streamlines that. Thanks!
Looks good to me! r? @dtolnay for libs team FCP |
Reassigning for an opinion on FCP since the tracking issue is quite bare and I haven't been up to speed on the use cases/whether this would be ready to consider stabilizing: r? @withoutboats |
@dtolnay I've posted an overview of use cases on the tracking issue: #69912 (comment). |
Updated with feedback from @jyn514, @tmiasko, and @Aaron1011. Also bumped the version to point to |
☔ The latest upstream changes (presumably #73265) made this pull request unmergeable. Please resolve the merge conflicts. |
cc @rust-lang/libs this hasn't made it up to the top of our nominated backlog to discuss yet. Are we happy to proceed with the stabilization of |
Rebased on the main branch and tidied up the commits; think that should bring this PR back to a state where it can be merged if the libs team decides it's right to do so. |
☔ The latest upstream changes (presumably #81625) made this pull request unmergeable. Please resolve the merge conflicts. |
Co-Authored-By: Ashley Mannix <[email protected]>
I'd be in favor of this, even if that meant we couldn't later implement the blanket impl for My worry is that because we currently don't have anyone dedicated to figuring out the type level details, if we defer making any decisions, |
@bors r+ |
📌 Commit 2c8bf1d has been approved by |
⌛ Testing commit 2c8bf1d with merge efaa305a16a30dc82272f1b5d7d63c7102370167... |
💥 Test timed out |
@bors retry |
This comment has been minimized.
This comment has been minimized.
Stabilize the Wake trait This PR proposes stabilizing the `wake_trait` feature, tracking issue rust-lang#69912. ## Motivation The surface area this trait introduces is small, and it has been on nightly for 4 months without any reported issues. Given the surface area of this trait is small and only serves to provide a safe interface around the already stable [`std::task::RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWaker.html) it seems unlikely this trait will require any further changes. So I'm proposing we stabilize this. Personally I would love to have this available on stable, since it would enable cleaning up some runtime internals by removing the tedious pointer required to construct a [`RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWakerVTable.html). I believe the intent was always to introduce a `Wake` counterpart to `RawWaker` in order to safely construct `Waker` instances. And the `Wake` trait feels like it does that job as intended. ## Implementation notes This PR itself fixes a link in the docs, and introduces an example of how to use the trait: a minimal `block_on` example that runs a future to completion on the current thread. It doesn't include fancier features such as support for nesting, but is intended to serve as a teaching device for both `task::Wake` and futures alike.
Rollup of 9 pull requests Successful merges: - rust-lang#74304 (Stabilize the Wake trait) - rust-lang#79805 (Rename Iterator::fold_first to reduce and stabilize it) - rust-lang#81556 (introduce future-compatibility warning for forbidden lint groups) - rust-lang#81645 (Add lint for `panic!(123)` which is not accepted in Rust 2021.) - rust-lang#81710 (OsStr eq_ignore_ascii_case takes arg by value) - rust-lang#81711 (add #[inline] to all the public IpAddr functions) - rust-lang#81725 (Move test to be with the others) - rust-lang#81727 (Revert stabilizing integer::BITS.) - rust-lang#81745 (Stabilize poison API of Once, rename poisoned()) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR proposes stabilizing the
wake_trait
feature, tracking issue #69912.Motivation
The surface area this trait introduces is small, and it has been on nightly for 4 months without any reported issues. Given the surface area of this trait is small and only serves to provide a safe interface around the already stable
std::task::RawWakerVTable
it seems unlikely this trait will require any further changes. So I'm proposing we stabilize this.Personally I would love to have this available on stable, since it would enable cleaning up some runtime internals by removing the tedious pointer required to construct a
RawWakerVTable
. I believe the intent was always to introduce aWake
counterpart toRawWaker
in order to safely constructWaker
instances. And theWake
trait feels like it does that job as intended.Implementation notes
This PR itself fixes a link in the docs, and introduces an example of how to use the trait: a minimal
block_on
example that runs a future to completion on the current thread. It doesn't include fancier features such as support for nesting, but is intended to serve as a teaching device for bothtask::Wake
and futures alike.