Skip to content

Commit 2bf7865

Browse files
committed
Auto merge of rust-lang#133089 - eholk:stabilize-noop-waker, r=dtolnay
Stabilize noop_waker Tracking Issue: rust-lang#98286 This is a handy feature that's been used widely in tests and example async code and it'd be nice to make it available to users. cc `@rust-lang/wg-async`
2 parents 706141b + 72ce1ab commit 2bf7865

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+104
-132
lines changed

library/alloc/src/task.rs

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
199199
///
200200
/// ```rust
201201
/// #![feature(local_waker)]
202-
/// #![feature(noop_waker)]
203202
/// use std::task::{LocalWake, ContextBuilder, LocalWaker, Waker};
204203
/// use std::future::Future;
205204
/// use std::pin::Pin;

library/core/src/task/wake.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ impl RawWaker {
6060
RawWaker { data, vtable }
6161
}
6262

63-
#[unstable(feature = "noop_waker", issue = "98286")]
63+
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
64+
#[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
6465
const NOOP: RawWaker = {
6566
const VTABLE: RawWakerVTable = RawWakerVTable::new(
6667
// Cloning just returns a new no-op raw waker
@@ -283,7 +284,6 @@ impl fmt::Debug for Context<'_> {
283284
/// # Examples
284285
/// ```
285286
/// #![feature(local_waker)]
286-
/// #![feature(noop_waker)]
287287
/// use std::task::{ContextBuilder, LocalWaker, Waker, Poll};
288288
/// use std::future::Future;
289289
///
@@ -555,8 +555,6 @@ impl Waker {
555555
/// # Examples
556556
///
557557
/// ```
558-
/// #![feature(noop_waker)]
559-
///
560558
/// use std::future::Future;
561559
/// use std::task;
562560
///
@@ -567,7 +565,8 @@ impl Waker {
567565
/// ```
568566
#[inline]
569567
#[must_use]
570-
#[unstable(feature = "noop_waker", issue = "98286")]
568+
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
569+
#[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
571570
pub const fn noop() -> &'static Waker {
572571
const WAKER: &Waker = &Waker { waker: RawWaker::NOOP };
573572
WAKER
@@ -850,8 +849,6 @@ impl LocalWaker {
850849
///
851850
/// ```
852851
/// #![feature(local_waker)]
853-
/// #![feature(noop_waker)]
854-
///
855852
/// use std::future::Future;
856853
/// use std::task::{ContextBuilder, LocalWaker, Waker, Poll};
857854
///
@@ -864,7 +861,7 @@ impl LocalWaker {
864861
/// ```
865862
#[inline]
866863
#[must_use]
867-
#[unstable(feature = "noop_waker", issue = "98286")]
864+
#[unstable(feature = "local_waker", issue = "118959")]
868865
pub const fn noop() -> &'static LocalWaker {
869866
const WAKER: &LocalWaker = &LocalWaker { waker: RawWaker::NOOP };
870867
WAKER

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#![feature(maybe_uninit_write_slice)]
6262
#![feature(min_specialization)]
6363
#![feature(never_type)]
64-
#![feature(noop_waker)]
6564
#![feature(num_midpoint_signed)]
6665
#![feature(numfmt)]
6766
#![feature(pattern)]

src/tools/miri/tests/pass/async-closure-captures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Same as rustc's `tests/ui/async-await/async-closures/captures.rs`, keep in sync
22

3-
#![feature(async_closure, noop_waker, async_trait_bounds)]
3+
#![feature(async_closure, async_trait_bounds)]
44

55
use std::future::Future;
66
use std::pin::pin;

src/tools/miri/tests/pass/async-closure-drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_closure, noop_waker, async_trait_bounds)]
1+
#![feature(async_closure, async_trait_bounds)]
22

33
use std::future::Future;
44
use std::pin::pin;

src/tools/miri/tests/pass/async-closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_closure, noop_waker, async_fn_traits)]
1+
#![feature(async_closure, async_fn_traits)]
22
#![allow(unused)]
33

44
use std::future::Future;

src/tools/miri/tests/pass/async-drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// please consider modifying rustc's async drop test at
77
// `tests/ui/async-await/async-drop.rs`.
88

9-
#![feature(async_drop, impl_trait_in_assoc_type, noop_waker, async_closure)]
9+
#![feature(async_drop, impl_trait_in_assoc_type, async_closure)]
1010
#![allow(incomplete_features, dead_code)]
1111

1212
// FIXME(zetanumbers): consider AsyncDestruct::async_drop cleanup tests

src/tools/miri/tests/pass/async-fn.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(never_type)]
2-
#![feature(noop_waker)]
32

43
use std::future::Future;
54

src/tools/miri/tests/pass/dyn-star.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![feature(dyn_star)]
22
#![allow(incomplete_features)]
33
#![feature(custom_inner_attributes)]
4-
#![feature(noop_waker)]
54
// rustfmt destroys `dyn* Trait` syntax
65
#![rustfmt::skip]
76

src/tools/miri/tests/pass/future-self-referential.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
3-
#![feature(noop_waker)]
43

54
use std::future::*;
65
use std::marker::PhantomPinned;

src/tools/miri/tests/pass/issues/issue-miri-2068.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(noop_waker)]
2-
31
use std::future::Future;
42
use std::pin::Pin;
53
use std::task::{Context, Poll, Waker};

src/tools/miri/tests/pass/move-data-across-await-point.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(noop_waker)]
21
use std::future::Future;
32
use std::ptr;
43

0 commit comments

Comments
 (0)