-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking issue for IntoFuture
#67644
Comments
…akis Add core::future::IntoFuture This patch reintroduces the `core::future::IntoFuture` trait. However unlike earlier PRs this patch does not integrate it into the `async/.await` lowering since that lead to performance regressions. By introducing the trait separately from the integration, the integration PR can be more narrowly scoped, and people can start trying out the `IntoFuture` trait today. Thanks heaps! cc/ @rust-lang/wg-async-foundations ## References - Original PR adding `IntoFuture` rust-lang#65244 - Open issue to re-land `IntoFuture` (assigned to me) rust-lang#67982 - Tracking issue for `IntoFuture` rust-lang#67644
Are there any blockers on this?
|
cc @yoshuawuyts who may have some context |
This was implemented, but then reverted due to a performance regression. #69218 may help reduce the impact of implementing this. |
how to use this in an app if I want to still use it |
any update? |
This is a reintroduction of the remaining parts from rust-lang#65244 that have not been relanded yet. Issues rust-langGH-67644, rust-langGH-67982
Reintroduce `into_future` in `.await` desugaring This is a reintroduction of the remaining parts from rust-lang#65244 that have not been relanded yet. This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again. Issues rust-lang#67644, rust-lang#67982 /cc `@yoshuawuyts`
Just for a clarification (and to be similar to newer tracking issues) Feature gate: This is a tracking issue for the Since #90737 this trait is also automatically used in struct NotAFutureYet;
impl IntoFuture for NotAFutureYet {
type Output = u8;
type IntoFuture = Ready<Self::Output>;
fn into_future(self) -> Self::IntoFuture {
ready(42)
}
}
async fn test() {
assert_eq!(NotAFutureYet.await, 42);
} Public API// core::future
pub trait IntoFuture {
type Output;
type IntoFuture: Future<Output = Self::Output>;
fn into_future(self) -> Self::IntoFuture;
} Steps / History
Unresolved Questions
|
I wonder though if the method should be called |
@WaffleLapkin I don't think we should; "future" is a pretty short name already. The "iterator" submodule is named @rust-lang/libs-api now that #67982 has landed I'd like to propose we FCP |
👎 I'd veto stabilizing |
@dtolnay that seems reasonable; happy to revisit this in a couple of months. |
@yaahc It appears both |
Both is correct given that this affects meaning of |
@rfcbot reviewed This is great, looking forward to this. |
…nTitor,yaahc update docs for `std::future::IntoFuture` Ref rust-lang#67644. This updates the docs for `IntoFuture` providing a bit more guidance on how to use it. Thanks!
…nTitor,yaahc update docs for `std::future::IntoFuture` Ref rust-lang#67644. This updates the docs for `IntoFuture` providing a bit more guidance on how to use it. Thanks!
…nTitor,yaahc update docs for `std::future::IntoFuture` Ref rust-lang#67644. This updates the docs for `IntoFuture` providing a bit more guidance on how to use it. Thanks!
🔔 This is now entering its final comment period, as per the review above. 🔔 |
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. This will be merged soon. |
…r=yaahc Stabilize `into_future` rust-lang#67644 has been labeled with [S-tracking-ready-to-stabilize](https://github.com/rust-lang/rust/labels/S-tracking-ready-to-stabilize) - which mentions someone needs to file a stabilization PR. So hence this PR! ✨ Thanks! Closes rust-lang#67644 r? `@joshtriplett`
I'm guessing this should be tagged with relnotes, or does to-announce already imply that? |
👍, David went and tagged the PR |
update docs for `std::future::IntoFuture` Ref rust-lang/rust#67644. This updates the docs for `IntoFuture` providing a bit more guidance on how to use it. Thanks!
Stabilize `into_future` rust-lang/rust#67644 has been labeled with [S-tracking-ready-to-stabilize](https://github.com/rust-lang/rust/labels/S-tracking-ready-to-stabilize) - which mentions someone needs to file a stabilization PR. So hence this PR! ✨ Thanks! Closes rust-lang/rust#67644 r? ``@joshtriplett``
Introduced in #65244, this is a trait of a type that can be converted into a
Future
, used by.await
(similar to howIntoIterator
is used withfor
).a more complete description can be found in #67644 (comment)
The text was updated successfully, but these errors were encountered: