Skip to content

the documentation for the Future trait specifies invariants that are not always true #125050

@lolbinarycat

Description

@lolbinarycat
Contributor

Location

https://doc.rust-lang.org/std/future/trait.Future.html

Summary

A future represents an asynchronous computation obtained by use of async.

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 as tokio::task::spawn

Runtime characteristics

Futures alone are inert; they must be actively polled to make progress, meaning that each time the current task is woken up, it should actively re-poll pending futures that it still has an interest in.

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 are awaited sequentially.

Activity

added
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
on May 12, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 12, 2024
added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
C-bugCategory: This is a bug.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 13, 2024
changed the title [-]the documentation for the Future trait specifies invarients that are not always true[/-] [+]the documentation for the Future trait specifies invariants that are not always true[/+] on May 14, 2024
self-assigned this
on Apr 9, 2025
added
E-help-wantedCall for participation: Help is requested to fix this issue.
on Apr 9, 2025
removed their assignment
on Apr 19, 2025
linked a pull request that will close this issue on Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @lolbinarycat@jieyouxu@rustbot

      Issue actions

        the documentation for the Future trait specifies invariants that are not always true · Issue #125050 · rust-lang/rust