We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Waker::noop()
1 parent 219b00d commit 7052188Copy full SHA for 7052188
library/core/src/task/wake.rs
@@ -354,6 +354,11 @@ impl Waker {
354
#[must_use]
355
#[unstable(feature = "noop_waker", issue = "98286")]
356
pub const fn noop() -> &'static Waker {
357
+ // Ideally all this data would be explicitly `static` because it is used by reference and
358
+ // only ever needs one copy. But `const fn`s (and `const` items) cannot refer to statics,
359
+ // even though their values can be promoted to static. (That might change; see #119618.)
360
+ // An alternative would be a `pub static NOOP: &Waker`, but associated static items are not
361
+ // currently allowed either, and making it non-associated would be unergonomic.
362
const VTABLE: RawWakerVTable = RawWakerVTable::new(
363
// Cloning just returns a new no-op raw waker
364
|_| RAW,
0 commit comments