From a330a9432d0d5a48c124273b646324d13991e29c Mon Sep 17 00:00:00 2001 From: mental Date: Mon, 24 Aug 2020 15:44:03 +0100 Subject: [PATCH] feature gate const-constructors to nightly they require feature(const_fn) which is not available on stable. --- tokio/src/lib.rs | 2 +- tokio/src/loom/std/atomic_usize.rs | 2 +- tokio/src/loom/std/parking_lot.rs | 2 +- tokio/src/sync/batch_semaphore.rs | 2 +- tokio/src/sync/mutex.rs | 2 +- tokio/src/util/linked_list.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index a1514c6ebe6..e37e3ca1c27 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -17,7 +17,7 @@ ))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, feature(doc_alias))] -#![cfg_attr(all(feature = "parking_lot", not(all(loom, test)),), feature(const_fn))] +#![cfg_attr(all(feature = "nightly", feature = "parking_lot", not(all(loom, test))), feature(const_fn))] //! A runtime for writing reliable, asynchronous, and slim applications. //! diff --git a/tokio/src/loom/std/atomic_usize.rs b/tokio/src/loom/std/atomic_usize.rs index 8e7c6a4e98f..2057890fd6f 100644 --- a/tokio/src/loom/std/atomic_usize.rs +++ b/tokio/src/loom/std/atomic_usize.rs @@ -16,7 +16,7 @@ impl AtomicUsize { AtomicUsize { inner } } - #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] + #[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))] pub(crate) const fn const_new(val: usize) -> AtomicUsize { let inner = UnsafeCell::new(std::sync::atomic::AtomicUsize::new(val)); AtomicUsize { inner } diff --git a/tokio/src/loom/std/parking_lot.rs b/tokio/src/loom/std/parking_lot.rs index 4138b60db3d..e37cae34f47 100644 --- a/tokio/src/loom/std/parking_lot.rs +++ b/tokio/src/loom/std/parking_lot.rs @@ -27,7 +27,7 @@ impl Mutex { } #[inline] - #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] + #[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))] pub(crate) const fn const_new(t: T) -> Mutex { Mutex(parking_lot::const_mutex(t)) } diff --git a/tokio/src/sync/batch_semaphore.rs b/tokio/src/sync/batch_semaphore.rs index 131d8dfa4e4..3cd89cfe5eb 100644 --- a/tokio/src/sync/batch_semaphore.rs +++ b/tokio/src/sync/batch_semaphore.rs @@ -126,7 +126,7 @@ impl Semaphore { /// Creates a new semaphore with the initial number of permits /// /// Maximum number of permits on 32-bit platforms is `1<<29`. - #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] + #[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))] pub(crate) const fn const_new(permits: usize) -> Self { // FIXME: assertions and by extension panics are still being worked on: https://github.com/rust-lang/rust/issues/74925 Self { diff --git a/tokio/src/sync/mutex.rs b/tokio/src/sync/mutex.rs index b354d31e56d..c965656ad91 100644 --- a/tokio/src/sync/mutex.rs +++ b/tokio/src/sync/mutex.rs @@ -228,7 +228,7 @@ impl Mutex { /// /// static lock: Mutex = Mutex::const_new(5); /// ``` - #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] + #[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))] pub const fn const_new(t: T) -> Self where T: Sized, diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs index 4d1b28bab82..c0d2b046806 100644 --- a/tokio/src/util/linked_list.rs +++ b/tokio/src/util/linked_list.rs @@ -76,7 +76,7 @@ impl LinkedList { } /// Creates an empty linked list - #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] + #[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))] pub(crate) const fn const_new() -> LinkedList { LinkedList { head: None,