the documentation for the Future trait specifies invariants that are not always true #125050
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
C-bug
Category: This is a bug.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Location
https://doc.rust-lang.org/std/future/trait.Future.html
Summary
this is not always true, a future represents a value that can be joined into an async function using
await
, however futures can be returned by non-async functions, such astokio::task::spawn
once again, this is true for futures created by calling async functions, but may not be true for all types that implement the Future trait, such as
tokio::task::JoinHandle
.the distinction between futures that are and are not inert is important, an array of
task::JoinHandle
is useful for performing several operations concurrently, however an array of futures created by calling async functions will not result in concurrent execution if they areawait
ed sequentially.The text was updated successfully, but these errors were encountered: