Skip to content
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 into_future #98718

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions library/core/src/future/into_future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ use crate::future::Future;
/// on all futures.
///
/// ```no_run
/// #![feature(into_future)]
///
/// use std::future::IntoFuture;
///
/// # async fn foo() {
Expand All @@ -33,8 +31,6 @@ use crate::future::Future;
/// multiple times before being `.await`ed.
///
/// ```rust
/// #![feature(into_future)]
///
/// use std::future::{ready, Ready, IntoFuture};
///
/// /// Eventually multiply two numbers
Expand Down Expand Up @@ -91,8 +87,6 @@ use crate::future::Future;
/// `IntoFuture::into_future` to obtain an instance of `Future`:
///
/// ```rust
/// #![feature(into_future)]
///
/// use std::future::IntoFuture;
///
/// /// Convert the output of a future to a string.
Expand All @@ -104,14 +98,14 @@ use crate::future::Future;
/// format!("{:?}", fut.await)
/// }
/// ```
#[unstable(feature = "into_future", issue = "67644")]
#[stable(feature = "into_future", since = "1.64.0")]
pub trait IntoFuture {
/// The output that the future will produce on completion.
#[unstable(feature = "into_future", issue = "67644")]
#[stable(feature = "into_future", since = "1.64.0")]
type Output;

/// Which kind of future are we turning this into?
#[unstable(feature = "into_future", issue = "67644")]
#[stable(feature = "into_future", since = "1.64.0")]
type IntoFuture: Future<Output = Self::Output>;

/// Creates a future from a value.
Expand All @@ -121,8 +115,6 @@ pub trait IntoFuture {
/// Basic usage:
///
/// ```no_run
/// #![feature(into_future)]
///
/// use std::future::IntoFuture;
///
/// # async fn foo() {
Expand All @@ -131,12 +123,12 @@ pub trait IntoFuture {
/// assert_eq!("meow", fut.await);
/// # }
/// ```
#[unstable(feature = "into_future", issue = "67644")]
#[stable(feature = "into_future", since = "1.64.0")]
#[lang = "into_future"]
fn into_future(self) -> Self::IntoFuture;
}

#[unstable(feature = "into_future", issue = "67644")]
#[stable(feature = "into_future", since = "1.64.0")]
impl<F: Future> IntoFuture for F {
type Output = F::Output;
type IntoFuture = F;
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub use self::future::Future;
#[unstable(feature = "future_join", issue = "91642")]
pub use self::join::join;

#[unstable(feature = "into_future", issue = "67644")]
#[stable(feature = "into_future", since = "1.64.0")]
pub use into_future::IntoFuture;

#[stable(feature = "future_readiness_fns", since = "1.48.0")]
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/async-await/await-into-future.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// run-pass
// aux-build: issue-72470-lib.rs
// edition:2021
#![feature(into_future)]

extern crate issue_72470_lib;
use std::{future::{Future, IntoFuture}, pin::Pin};

Expand Down