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

Use poll_fn from the standard library #6810

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

eduardosm
Copy link
Contributor

Motivation

std::future::poll_fn has been stabilized in Rust 1.64 and Tokio's MSRV is now 1.70.

Solution

poll_fn defined in tokio and tokio-stream have been removed and replaced with std's version. Uses of futures::future::poll_fn have also been replaced.

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-sync Run loom sync tests on this PR R-loom-time-driver Run loom time driver tests on this PR labels Aug 31, 2024
pub use crate::future::maybe_done::maybe_done;

pub use std::future::poll_fn;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it makes more sense to just have the select! macro use the std poll_fn directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are already other items from std being imported in macros::support:

pub use std::future::{Future, IntoFuture};
pub use std::pin::Pin;
pub use std::task::Poll;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point.

@Darksonn Darksonn added the A-tokio Area: The main tokio crate label Sep 5, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn merged commit 12b2567 into tokio-rs:master Sep 5, 2024
86 checks passed
@eduardosm eduardosm deleted the libstd-poll_fn branch September 5, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate R-loom-current-thread Run loom current-thread tests on this PR R-loom-sync Run loom sync tests on this PR R-loom-time-driver Run loom time driver tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants