rust-lang / rust-lang/rust

The document of `Future` lacks the specification to say every calling to `poll` of the same future shall happens-before another

Open
#159,385 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-docs needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Location (URL)

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

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

Summary

The current document of Future doesn't specify the ordering relationship for every call to Future::poll. This point is especially critical for these runtimes that have the characteristic of stealing tasks for idle threads. According to the signature of poll, whose receiver type is Pin<& mut Self>, which may be used to modify its internal fields, and the next polling might do the same thing or just a read, however, these operations shouldn't contribute to a data race, even though the future is polling again in another thread.

That is, it is plausible to say every previous call to poll() happens-before the subsequent one of the same future in any case. However, this guarantee is lacking in the current document.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the Future trait documentation at the core and std URLs, focusing on the Future::poll contract and its wording about repeated polling. Determine the precise ordering guarantee the specification should state, then update both documented locations and verify that the wording consistently describes the intended happens-before relationship.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.