Skip to content
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 noop_waker #133089

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion library/alloc/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
///
/// ```rust
/// #![feature(local_waker)]
/// #![feature(noop_waker)]
/// use std::task::{LocalWake, ContextBuilder, LocalWaker, Waker};
/// use std::future::Future;
/// use std::pin::Pin;
Expand Down
13 changes: 5 additions & 8 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ impl RawWaker {
RawWaker { data, vtable }
}

#[unstable(feature = "noop_waker", issue = "98286")]
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
const NOOP: RawWaker = {
Comment on lines +63 to 65
Copy link
Member

@dtolnay dtolnay Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a const, not a const fn, so there should be no need for a rustc_const_stable attribute. There is no such thing as a non-const const, or a stable const that is not stably usable in const.

Suggested change
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
const NOOP: RawWaker = {
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
const NOOP: RawWaker = {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eholk Why was this resolved? Unless the diff is somehow wrong, this wasn't changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was resolved in 2f45ea5 before I approved this PR in #133089 (comment).

That commit got lost by the force push above #133089 (comment).

@eholk please follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, sorry about that. I have a PR up here to remove it: #134100

const VTABLE: RawWakerVTable = RawWakerVTable::new(
// Cloning just returns a new no-op raw waker
Expand Down Expand Up @@ -283,7 +284,6 @@ impl fmt::Debug for Context<'_> {
/// # Examples
/// ```
/// #![feature(local_waker)]
/// #![feature(noop_waker)]
/// use std::task::{ContextBuilder, LocalWaker, Waker, Poll};
/// use std::future::Future;
///
Expand Down Expand Up @@ -555,8 +555,6 @@ impl Waker {
/// # Examples
///
/// ```
/// #![feature(noop_waker)]
///
/// use std::future::Future;
/// use std::task;
///
Expand All @@ -567,7 +565,8 @@ impl Waker {
/// ```
#[inline]
#[must_use]
#[unstable(feature = "noop_waker", issue = "98286")]
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
pub const fn noop() -> &'static Waker {
const WAKER: &Waker = &Waker { waker: RawWaker::NOOP };
WAKER
Expand Down Expand Up @@ -850,8 +849,6 @@ impl LocalWaker {
///
/// ```
/// #![feature(local_waker)]
/// #![feature(noop_waker)]
///
/// use std::future::Future;
/// use std::task::{ContextBuilder, LocalWaker, Waker, Poll};
///
Expand All @@ -864,7 +861,7 @@ impl LocalWaker {
/// ```
#[inline]
#[must_use]
#[unstable(feature = "noop_waker", issue = "98286")]
#[unstable(feature = "local_waker", issue = "118959")]
pub const fn noop() -> &'static LocalWaker {
const WAKER: &LocalWaker = &LocalWaker { waker: RawWaker::NOOP };
WAKER
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#![feature(maybe_uninit_write_slice)]
#![feature(min_specialization)]
#![feature(never_type)]
#![feature(noop_waker)]
#![feature(num_midpoint_signed)]
#![feature(numfmt)]
#![feature(pattern)]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/pass/async-closure-captures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Same as rustc's `tests/ui/async-await/async-closures/captures.rs`, keep in sync

#![feature(async_closure, noop_waker, async_trait_bounds)]
#![feature(async_closure, async_trait_bounds)]

use std::future::Future;
use std::pin::pin;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/pass/async-closure-drop.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(async_closure, noop_waker, async_trait_bounds)]
#![feature(async_closure, async_trait_bounds)]

use std::future::Future;
use std::pin::pin;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/pass/async-closure.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(async_closure, noop_waker, async_fn_traits)]
#![feature(async_closure, async_fn_traits)]
#![allow(unused)]

use std::future::Future;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/pass/async-drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// please consider modifying rustc's async drop test at
// `tests/ui/async-await/async-drop.rs`.

#![feature(async_drop, impl_trait_in_assoc_type, noop_waker, async_closure)]
#![feature(async_drop, impl_trait_in_assoc_type, async_closure)]
#![allow(incomplete_features, dead_code)]

// FIXME(zetanumbers): consider AsyncDestruct::async_drop cleanup tests
Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/pass/async-fn.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(never_type)]
#![feature(noop_waker)]

use std::future::Future;

Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/pass/dyn-star.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![feature(dyn_star)]
#![allow(incomplete_features)]
#![feature(custom_inner_attributes)]
#![feature(noop_waker)]
// rustfmt destroys `dyn* Trait` syntax
#![rustfmt::skip]

Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/pass/future-self-referential.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@revisions: stack tree
//@[tree]compile-flags: -Zmiri-tree-borrows
#![feature(noop_waker)]

use std::future::*;
use std::marker::PhantomPinned;
Expand Down
2 changes: 0 additions & 2 deletions src/tools/miri/tests/pass/issues/issue-miri-2068.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(noop_waker)]

use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll, Waker};
Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/pass/move-data-across-await-point.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(noop_waker)]
use std::future::Future;
use std::ptr;

Expand Down
Loading
Loading