Skip to content

Commit

Permalink
Rollup merge of #99306 - JohnTitor:stabilize-future-poll-fn, r=joshtr…
Browse files Browse the repository at this point in the history
…iplett

Stabilize `future_poll_fn`

FCP is done: #72302 (comment)
Closes #72302

r? `@joshtriplett` as you started FCP

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor authored Jul 17, 2022
2 parents 28cce68 + 084ad59 commit 5052769
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions library/core/src/future/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::task::{Context, Poll};
/// # Examples
///
/// ```
/// #![feature(future_join, future_poll_fn)]
/// #![feature(future_join)]
///
/// use std::future::join;
///
Expand All @@ -31,7 +31,7 @@ use crate::task::{Context, Poll};
/// `join!` is variadic, so you can pass any number of futures:
///
/// ```
/// #![feature(future_join, future_poll_fn)]
/// #![feature(future_join)]
///
/// use std::future::join;
///
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 @@ -37,7 +37,7 @@ pub use pending::{pending, Pending};
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
pub use ready::{ready, Ready};

#[unstable(feature = "future_poll_fn", issue = "72302")]
#[stable(feature = "future_poll_fn", since = "1.64.0")]
pub use poll_fn::{poll_fn, PollFn};

/// This type is needed because:
Expand Down
11 changes: 5 additions & 6 deletions library/core/src/future/poll_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::task::{Context, Poll};
/// # Examples
///
/// ```
/// #![feature(future_poll_fn)]
/// # async fn run() {
/// use core::future::poll_fn;
/// use std::task::{Context, Poll};
Expand All @@ -23,7 +22,7 @@ use crate::task::{Context, Poll};
/// assert_eq!(read_future.await, "Hello, World!".to_owned());
/// # }
/// ```
#[unstable(feature = "future_poll_fn", issue = "72302")]
#[stable(feature = "future_poll_fn", since = "1.64.0")]
pub fn poll_fn<T, F>(f: F) -> PollFn<F>
where
F: FnMut(&mut Context<'_>) -> Poll<T>,
Expand All @@ -36,22 +35,22 @@ where
/// This `struct` is created by [`poll_fn()`]. See its
/// documentation for more.
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[unstable(feature = "future_poll_fn", issue = "72302")]
#[stable(feature = "future_poll_fn", since = "1.64.0")]
pub struct PollFn<F> {
f: F,
}

#[unstable(feature = "future_poll_fn", issue = "72302")]
#[stable(feature = "future_poll_fn", since = "1.64.0")]
impl<F> Unpin for PollFn<F> {}

#[unstable(feature = "future_poll_fn", issue = "72302")]
#[stable(feature = "future_poll_fn", since = "1.64.0")]
impl<F> fmt::Debug for PollFn<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("PollFn").finish()
}
}

#[unstable(feature = "future_poll_fn", issue = "72302")]
#[stable(feature = "future_poll_fn", since = "1.64.0")]
impl<T, F> Future for PollFn<F>
where
F: FnMut(&mut Context<'_>) -> Poll<T>,
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#![feature(fmt_internals)]
#![feature(float_minimum_maximum)]
#![feature(future_join)]
#![feature(future_poll_fn)]
#![feature(generic_assert_internals)]
#![feature(array_try_from_fn)]
#![feature(hasher_prefixfree_extras)]
Expand Down

0 comments on commit 5052769

Please sign in to comment.