-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize waker_getters
#129919
Stabilize waker_getters
#129919
Conversation
library/core/src/task/wake.rs
Outdated
#[stable(feature = "waker_getters", since = "CURRENT_RUSTC_VERSION")] | ||
pub fn data(&self) -> *const () { | ||
self.data | ||
} | ||
|
||
/// Gets the `vtable` pointer used to create this `RawWaker`. | ||
#[inline] | ||
#[must_use] | ||
#[unstable(feature = "waker_getters", issue = "96992")] | ||
#[stable(feature = "waker_getters", since = "CURRENT_RUSTC_VERSION")] | ||
pub fn vtable(&self) -> &'static RawWakerVTable { | ||
self.vtable | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API still needs to be updated to what was decided via FCP here:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Should the new pub const unsafe fn new(data: *const (), vtable: &'static RawWakerVTable) -> Self;
constructor from that comment be made immediately stable in this PR? Or should that be done separately under a new feature since it's not really part of waker_getters
? The plan to deprecate RawWaker
doesn't work because it's in the RawWakerVTable
signature as discussed in later comments on the tracking issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @dtolnay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waker::new
is an obvious function with an obvious name, and is the composition of 2 already-stable APIs (RawWaker::new
+ Waker::from_raw
). It was discussed by most of the team in a library API team meeting (#96992 (comment)) and approved by the team's consensus process in #96992 (comment) with no objections. I think the circumstances are fine to stabilize this immediately.
Per the `waker_getters` FCP: rust-lang#96992 (comment)
Per the `waker_getters` FCP: rust-lang#96992 (comment) Docs largely copied from `RawWaker::new`.
a3c13bc
to
22bd319
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@bors r+ |
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#101339 (enable -Zrandomize-layout in debug CI builds ) - rust-lang#120736 (rustdoc: add header map to the table of contents) - rust-lang#127021 (Add target support for RTEMS Arm) - rust-lang#128928 (CI: rfl: add more tools and steps) - rust-lang#129584 (warn the user if the upstream master branch is old) - rust-lang#129664 (Arbitrary self types v2: pointers feature gate.) - rust-lang#129752 (Make supertrait and implied predicates queries defaulted) - rust-lang#129918 (Update docs of `missing_abi` lint) - rust-lang#129919 (Stabilize `waker_getters`) - rust-lang#129925 (remove deprecated option `rust.split-debuginfo`) Failed merges: - rust-lang#129789 (rustdoc: use strategic boxing to shrink `clean::Item`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#101339 (enable -Zrandomize-layout in debug CI builds ) - rust-lang#120736 (rustdoc: add header map to the table of contents) - rust-lang#127021 (Add target support for RTEMS Arm) - rust-lang#128928 (CI: rfl: add more tools and steps) - rust-lang#129584 (warn the user if the upstream master branch is old) - rust-lang#129664 (Arbitrary self types v2: pointers feature gate.) - rust-lang#129752 (Make supertrait and implied predicates queries defaulted) - rust-lang#129918 (Update docs of `missing_abi` lint) - rust-lang#129919 (Stabilize `waker_getters`) - rust-lang#129925 (remove deprecated option `rust.split-debuginfo`) Failed merges: - rust-lang#129789 (rustdoc: use strategic boxing to shrink `clean::Item`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#129919 - kevinmehall:waker-getters, r=dtolnay Stabilize `waker_getters` Tracking issue: rust-lang#96992 FCP completed on the tracking issue a while ago. It's not clear whether the libs-api team wanted the `RawWaker` methods moved to `Waker` or went back to the current API after further discussion. `@Amanieu` [wrote "This is just waiting for someone to submit a stabilization PR."](rust-lang#96992 (comment)) so I'm doing just that in hopes of nudging this along. Edit: Moved the `data` and `vtable` methods from `RawWaker` to `Waker` and added `Waker::new` per rust-lang#96992 (comment) ```rs impl Waker { pub const unsafe fn new(data: *const (), vtable: &'static RawWakerVTable) -> Self; pub fn data(&self) -> *const (); pub fn vtable(&self) -> &'static RawWakerVTable; } ``` Closes rust-lang#96992
Tracking issue: #96992
FCP completed on the tracking issue a while ago. It's not clear whether the libs-api team wanted the
RawWaker
methods moved toWaker
or went back to the current API after further discussion. @Amanieu wrote "This is just waiting for someone to submit a stabilization PR." so I'm doing just that in hopes of nudging this along.Edit: Moved the
data
andvtable
methods fromRawWaker
toWaker
and addedWaker::new
per #96992 (comment)Closes #96992