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 }})
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 author
: the review is finished, PR author should check the comments and take action accordingly@rustbot review
: the author is ready for a review, this PR will be queued again in the reviewer's queue
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
This comment has been minimized.
This CI failure is strange:
Error: tidy error: /checkout/library/core/src/task/wake.rs:713:
issue
"87021" mismatches the previousissue
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.
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
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
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).
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?
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 Future
s, 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.
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.
…w the extention of contexts by futures
…y removing a #[cfg(target_has_atomic = ptr)]
This also removes
- impl From<&Context> for ContextBuilder
- Context::try_waker()
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.
@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.
Those comments seem sufficient to me (I hadn't seen them in my quick skim) for nightly experimentation.
@rustbot ready
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
📌 Commit 180c68b has been approved by Mark-Simulacrum
It is now in the queue for this repository.
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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…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
…iaskrgr
Rollup of 7 pull requests
Successful merges:
- rust-lang#113833 (
std::error::Error
-> Trait Implementations: lifetimes consistency improvement) - rust-lang#115386 (PartialEq, PartialOrd: update and synchronize handling of transitive chains)
- rust-lang#116284 (make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern)
- rust-lang#118960 (Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.)
- rust-lang#120060 (Use the same mir-opt bless targets on all platforms)
- rust-lang#120214 (match lowering: consistently lower bindings deepest-first)
- rust-lang#120384 (Use
<T, U>
for array/slice equalityimpl
s)
r? @ghost
@rustbot
modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…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
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#113833 (
std::error::Error
-> Trait Implementations: lifetimes consistency improvement) - rust-lang#115386 (PartialEq, PartialOrd: update and synchronize handling of transitive chains)
- rust-lang#116284 (make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern)
- rust-lang#118960 (Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.)
- rust-lang#120384 (Use
<T, U>
for array/slice equalityimpl
s) - rust-lang#120518 (riscv only supports split_debuginfo=off for now)
- rust-lang#120619 (Assert that params with the same index have the same name)
- rust-lang#120657 (Remove unused struct)
- rust-lang#120661 (target: default to the medium code model on LoongArch targets)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#113833 (
std::error::Error
-> Trait Implementations: lifetimes consistency improvement) - rust-lang#115386 (PartialEq, PartialOrd: update and synchronize handling of transitive chains)
- rust-lang#116284 (make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern)
- rust-lang#118960 (Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.)
- rust-lang#120384 (Use
<T, U>
for array/slice equalityimpl
s) - rust-lang#120518 (riscv only supports split_debuginfo=off for now)
- rust-lang#120657 (Remove unused struct)
- rust-lang#120661 (target: default to the medium code model on LoongArch targets)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#113833 (
std::error::Error
-> Trait Implementations: lifetimes consistency improvement) - rust-lang#115386 (PartialEq, PartialOrd: update and synchronize handling of transitive chains)
- rust-lang#116284 (make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern)
- rust-lang#118960 (Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc.)
- rust-lang#120384 (Use
<T, U>
for array/slice equalityimpl
s) - rust-lang#120518 (riscv only supports split_debuginfo=off for now)
- rust-lang#120657 (Remove unused struct)
- rust-lang#120661 (target: default to the medium code model on LoongArch targets)
r? @ghost
@rustbot
modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
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
bors pushed a commit to rust-lang-ci/rust that referenced this pull request
…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
…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
…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
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
Labels
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the library team, which will review and decide on the PR/issue.
Relevant to the library API team, which will review and decide on the PR/issue.