-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking Issue for const_waker
#102012
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
The const on Before stabilizing those consts, we should have a real-world use case in mind, and a new test that is representative of that use case. |
@rustbot labels +I-libs-api-nominated We discussed this in the WG-async call today. We observed there was a request for a use case here. We propose this one: #![feature(const_waker)]
// ###################################################################
// Supporting code.
pub use nop_waker::*;
mod nop_waker {
use core::{
future::Future,
pin::Pin,
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
};
pub const NOP_RAWWAKER: RawWaker = {
fn nop(_: *const ()) {}
const VTAB: RawWakerVTable =
RawWakerVTable::new(|_| NOP_RAWWAKER, nop, nop, nop);
RawWaker::new(&() as *const (), &VTAB)
};
pub const NOP_WAKER: &Waker =
&unsafe { Waker::from_raw(NOP_RAWWAKER) };
pub const NOP_CONTEXT: Context<'static> =
Context::from_waker(NOP_WAKER);
pub fn poll_once<T, F>(f: &mut F) -> Poll<T>
where
F: Future<Output = T> + ?Sized + Unpin,
{
let mut cx = NOP_CONTEXT;
Pin::new(f).as_mut().poll(&mut cx)
}
} This is code that's been copy-and-pasted into a number of places recently to support tests. More generally, in any context where one might want a We agreed that the above is a valid use case for Nominating as WG-async would like to see this move forward or hear more details about those concerns. |
Thanks Travis! Looks good. Prior to #95985, the tests related to this feature involved @rust-lang/libs-api: |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Stabilize `const_waker` Closes: rust-lang#102012. For `local_waker` and `context_ext` related things, I just ~~moved them to dedicated feature gates and reused their own tracking issue (maybe it's better to open a new one later, but at least they should not be tracked under rust-lang#102012 from the beginning IMO.)~~ reused their own feature gates as suggested by `@tgross35.` `@rustbot` label: +T-libs-api r? libs-api
…li-obk Stabilize `const_waker` Closes: rust-lang#102012. For `local_waker` and `context_ext` related things, I just ~~moved them to dedicated feature gates and reused their own tracking issue (maybe it's better to open a new one later, but at least they should not be tracked under rust-lang#102012 from the beginning IMO.)~~ reused their own feature gates as suggested by `@tgross35.` `@rustbot` label: +T-libs-api r? libs-api
Curious question: is this a step towards async const fns? |
Rollup merge of rust-lang#128228 - slanterns:const_waker, r=dtolnay,oli-obk Stabilize `const_waker` Closes: rust-lang#102012. For `local_waker` and `context_ext` related things, I just ~~moved them to dedicated feature gates and reused their own tracking issue (maybe it's better to open a new one later, but at least they should not be tracked under rust-lang#102012 from the beginning IMO.)~~ reused their own feature gates as suggested by ``@tgross35.`` ``@rustbot`` label: +T-libs-api r? libs-api
Feature gate:
#![feature(const_waker)]
This is a tracking issue for
const
ifying the following functions:Context::from_waker
Context::waker
Waker::from_raw
Public API
Steps / History
from_waker
,waker
andfrom_raw
unstablyconst
#101798Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: