-
Notifications
You must be signed in to change notification settings - Fork 13k
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 core::future::{pending,ready} #74328
Stabilize core::future::{pending,ready} #74328
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Can you elaborate on this? Is there some issue that we could reference? |
Note that most of these periods are before the async-await stabilizes. |
@Mark-Simulacrum I guess I hinted at this in the text of my original PR but didn't cover it explicitly (#70834):
The future returned from an
@taiki-e Yeah I agree; Together they make a good pairing to convey the Future state inside examples, as for example in use async_std::future;
let a = future::pending();
let b = future::ready(1u8);
assert_eq!(a.race(b).await, 1u8); This example wouldn't be possible without some form of [1]: I'd be happy to elaborate more on this if desired. It may be useful to establish guidelines about |
@rfcbot fcp merge These two functions return, respectively, a future that is ready and a future that is pending. The ready function takes an argument, which will be returned. The pending version would have to be implemented basically as it is. The ready version is importantly distinct from the async identity function because it implements Unpin and has a named future that can be stored in a struct. |
Team member @withoutboats has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@yoshuawuyts
This depends on the content of the example. async block is more powerful, flexible, and allows delayed execution, so I'd basically recommend using async block unless you need |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
☔ The latest upstream changes (presumably #73265) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased to address the merge conflict and addressed @taiki-e's final comments. |
|
@Nemo157 I'm not sure I follow? |
@Nemo157's saying that the impl can just be |
ah yes that makes sense! Updated with @Nemo157's feedback! |
Needs an |
@sfackler build passed! |
@bors r=sfackler |
📌 Commit 688f447 has been approved by |
…ess-fns, r=sfackler Stabilize core::future::{pending,ready} This PR stabilizes `core::future::{pending,ready}`, tracking issue rust-lang#70921. ## Motivation These functions have been on nightly for three months now, and have lived as part of the futures ecosystem for several years. In that time these functions have undergone several iterations, with [the `async-std` impls](https://docs.rs/async-std/1.6.2/async_std/future/index.html) probably diverging the most (using `async fn`, which in hindsight was a mistake). It seems the space around these functions has been _thoroughly_ explored over the last couple of years, and the ecosystem has settled on the current shape of the functions. It seems highly unlikely we'd want to make any further changes to these functions, so I propose we stabilize. ## Implementation notes This stabilization PR was fairly straightforward; this feature has already thoroughly been reviewed by the libs team already in rust-lang#70834. So all this PR does is remove the feature gate.
☀️ Test successful - checks-actions, checks-azure |
@Dylan-DPC is the 1.47 feature flag here correct? Shouldn't this be 1.48 since the first beta has already been cut? |
Ah ye. Can you submit a new PR with that small change? thanks |
…y-stabilization-label, r=Dylan-DPC Fix stabilization marker for future_readiness_fns Updated the rustc version in which this will be stabilized from `1.47.0 -> 1.48.0`. Fixes rust-lang#74328 (comment). Ref rust-lang#70921. r? @Dylan-DPC
This PR stabilizes
core::future::{pending,ready}
, tracking issue #70921.Motivation
These functions have been on nightly for three months now, and have lived as part of the futures ecosystem for several years. In that time these functions have undergone several iterations, with the
async-std
impls probably diverging the most (usingasync fn
, which in hindsight was a mistake).It seems the space around these functions has been thoroughly explored over the last couple of years, and the ecosystem has settled on the current shape of the functions. It seems highly unlikely we'd want to make any further changes to these functions, so I propose we stabilize.
Implementation notes
This stabilization PR was fairly straightforward; this feature has already thoroughly been reviewed by the libs team already in #70834. So all this PR does is remove the feature gate.