Skip to content

Commit

Permalink
Remove nightly feature requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
mental32 committed Sep 3, 2020
1 parent 6065e35 commit 687c687
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions tokio/src/lib.rs
Expand Up @@ -17,10 +17,6 @@
))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_alias))]
#![cfg_attr(
all(feature = "nightly", feature = "parking_lot", not(all(loom, test))),
feature(const_fn)
)]

//! A runtime for writing reliable, asynchronous, and slim applications.
//!
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/loom/std/atomic_usize.rs
Expand Up @@ -16,7 +16,7 @@ impl AtomicUsize {
AtomicUsize { inner }
}

#[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))]
#[cfg(all(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 }
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/loom/std/parking_lot.rs
Expand Up @@ -27,8 +27,8 @@ impl<T> Mutex<T> {
}

#[inline]
#[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "parking_lot", feature = "nightly"))))]
#[cfg(all(feature = "parking_lot", not(all(loom, test)),))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "parking_lot",))))]
pub(crate) const fn const_new(t: T) -> Mutex<T> {
Mutex(parking_lot::const_mutex(t))
}
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/sync/batch_semaphore.rs
Expand Up @@ -126,13 +126,13 @@ 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 = "nightly", feature = "parking_lot", not(all(loom, test)),))]
#[cfg(all(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 {
permits: AtomicUsize::const_new(permits << Self::PERMIT_SHIFT),
waiters: Mutex::const_new(Waitlist {
queue: LinkedList::const_new(),
queue: LinkedList::new(),
closed: false,
}),
}
Expand Down
6 changes: 3 additions & 3 deletions tokio/src/sync/mutex.rs
Expand Up @@ -226,10 +226,10 @@ impl<T: ?Sized> Mutex<T> {
/// ```
/// use tokio::sync::Mutex;
///
/// static lock: Mutex<i32> = Mutex::const_new(5);
/// static _: Mutex<i32> = Mutex::const_new(5);
/// ```
#[cfg(all(feature = "nightly", feature = "parking_lot", not(all(loom, test)),))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "parking_lot", feature = "nightly"))))]
#[cfg(all(feature = "parking_lot", not(all(loom, test)),))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "parking_lot",))))]
pub const fn const_new(t: T) -> Self
where
T: Sized,
Expand Down

0 comments on commit 687c687

Please sign in to comment.