Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc. by tvallotton · Pull Request #118960 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation36 Commits16 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

tvallotton

@rustbot

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Dec 15, 2023

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

cynecx

@tvallotton

This CI failure is strange:

Error: tidy error: /checkout/library/core/src/task/wake.rs:713: issue "87021" mismatches the previous issue of "96992"

It seems the error message is correct about the fact that we shouldn't be linking to #87021 and we should link instead to #96992. But it makes me question why does it only fail on my branch, I didn't change this issue number after all.

@rustbot

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

This was referenced

Dec 15, 2023

@tvallotton

Just for the record, it might be wise to check if ContextBuilder<'a> should be future proofed to be invariant, since I noticed that the with_waker example seems to break when changing the variance. Naturally, that makes the implementation of From<&mut Context> practically useless.

EDIT: This implementation was later removed

Mark-Simulacrum

Choose a reason for hiding this comment

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

Do we have signoff from T-libs-api on the new unstable surface area? The ACP issue seems to have had a good bit of discussion but I didn't see that signoff made explicit. If you can drive that towards a comment here or there and/or link something, that would be good.

I'm particularly concerned about the surface area confusing newer users -- especially given the frequent concerns over async complexity -- I wonder if we should add a sentence/paragraph to the top-level docs in https://doc.rust-lang.org/nightly/std/task/index.html to clarify the current state (i.e., stable surface area should be sufficient for most uses or so).

@tvallotton

I wonder if we should add a sentence/paragraph to the top-level docs in https://doc.rust-lang.org/nightly/std/task/index.html to clarify the current state (i.e., stable surface area should be sufficient for most uses or so).

I think it may be better to put it on the docs for LocalWaker. What do you think?

Thomasdezeeuw

Choose a reason for hiding this comment

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

I like to see a LocalWaker type, but this not the way to do it in my opinion. That's coming from someone who has written a lot of Futures, async function and a runtime specialised in thread-locality (i.e. I very much like to see this change).

I don't think making the Waker optional in Context is wise considering all existing Future related code depends on the Waker type always being part of the Context, it was never not there, a promise we're walking back with this pr.

@tvallotton

I made the waker type mandatory on the last commit. Several people have expressed their concern with this aspect of the API. And while I do think that it is better for them to be optional than not, that is not something I consider terribly important.

@bors

@tvallotton

@tvallotton

@tvallotton

@tvallotton

…w the extention of contexts by futures

@tvallotton

…y removing a #[cfg(target_has_atomic = ptr)]

@tvallotton

@tvallotton

@tvallotton

@tvallotton

This also removes

The from implementation is removed because now that wakers are always supported, there are less incentives to override the current context. Before, the incentive was to add Waker support to a reactor that didn't have any.

@tvallotton

@tvallotton

@Mark-Simulacrum Do we really need an explicit signoff here? Both teams have discussed it and approved nightly experimentation (libs-team, wg-async). I feel that with no significant changes on the proposal, it is going to be hard to get the teams to meet to discuss the same topic again.

@Mark-Simulacrum

Those comments seem sufficient to me (I hadn't seen them in my quick skim) for nightly experimentation.

@rustbot ready

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Jan 28, 2024

@Mark-Simulacrum

@bors

📌 Commit 180c68b has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 4, 2024

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Feb 5, 2024

@matthiaskrgr

…ulacrum

Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.

Implementation for rust-lang#118959.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 5, 2024

@bors

…iaskrgr

Rollup of 7 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Feb 5, 2024

@matthiaskrgr

…ulacrum

Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.

Implementation for rust-lang#118959.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 5, 2024

@bors

…iaskrgr

Rollup of 9 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 5, 2024

@bors

…iaskrgr

Rollup of 8 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 5, 2024

@bors

…iaskrgr

Rollup of 8 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Feb 5, 2024

@rust-timer

Rollup merge of rust-lang#118960 - tvallotton:local_waker, r=Mark-Simulacrum

Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.

Implementation for rust-lang#118959.

bors added a commit to rust-lang/rust-analyzer that referenced this pull request

Feb 8, 2024

@bors

bors pushed a commit to rust-lang-ci/rust that referenced this pull request

Feb 18, 2024

@matthiaskrgr

…ulacrum

Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.

Implementation for rust-lang#118959.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Aug 11, 2024

@matthiaskrgr

…cuviper

make LocalWaker::will_wake consistent with Waker::will_wake

This mirrors rust-lang#119863 for LocalWaker. Looks like that got missed in the initial LocalWaker PR (rust-lang#118960).

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Aug 11, 2024

@matthiaskrgr

…cuviper

make LocalWaker::will_wake consistent with Waker::will_wake

This mirrors rust-lang#119863 for LocalWaker. Looks like that got missed in the initial LocalWaker PR (rust-lang#118960).

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Aug 11, 2024

@rust-timer

Rollup merge of rust-lang#128882 - RalfJung:local-waker-will-wake, r=cuviper

make LocalWaker::will_wake consistent with Waker::will_wake

This mirrors rust-lang#119863 for LocalWaker. Looks like that got missed in the initial LocalWaker PR (rust-lang#118960).

RalfJung pushed a commit to RalfJung/miri that referenced this pull request

Aug 12, 2024

@matthiaskrgr

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

T-libs-api

Relevant to the library API team, which will review and decide on the PR/issue.