tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...

Home Page:https://tokio.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

join and select macros should use IntoFuture

conradludgate opened this issue · comments

Is your feature request related to a problem? Please describe.
A user was confused by the error messages when trying to select on an IntoFuture type.

Describe the solution you'd like
The join and select macros should call IntoFuture::into_future on setup.

Describe alternatives you've considered
Improve documentation in Rust to aid with suggesting fut.into_future() when an IntoFuture type is polled

Additional context
IntoFuture is stable since 1.64.0.

let mut futures = ( $( $fut , )+ );

let mut futures = ( $( maybe_done($e), )* );

Shouldn't all the tokio API (tokio::spawn, etc.) be updated to accepts IntoFuture instead of Future when the MRSV will be bumped?

Perhaps, but I would say that should be a separate issue from this. For the macros, this is motivated by the bad error messages, and I don't think they're as bad for tokio::spawn.