diff --git a/futures-util/Cargo.toml b/futures-util/Cargo.toml index bb5daa4d62..78b34df92e 100644 --- a/futures-util/Cargo.toml +++ b/futures-util/Cargo.toml @@ -23,7 +23,6 @@ io-compat = ["compat", "tokio-io"] bench = [] nightly = ["futures-core-preview/nightly", "futures-sink-preview/nightly"] cfg-target-has-atomic = ["futures-core-preview/cfg-target-has-atomic"] -never-type = [] alloc = ["futures-core-preview/alloc", "futures-sink-preview/alloc"] [dependencies] diff --git a/futures-util/src/future/mod.rs b/futures-util/src/future/mod.rs index f44bfb0cdb..d74bcb8735 100644 --- a/futures-util/src/future/mod.rs +++ b/futures-util/src/future/mod.rs @@ -76,9 +76,7 @@ pub use self::inspect::Inspect; mod unit_error; pub use self::unit_error::UnitError; -#[cfg(feature = "never-type")] mod never_error; -#[cfg(feature = "never-type")] pub use self::never_error::NeverError; mod either; @@ -516,9 +514,8 @@ pub trait FutureExt: Future { UnitError::new(self) } - #[cfg(feature = "never-type")] /// Turns a [`Future`](Future) into a - /// [`TryFuture](futures_core::future::TryFuture). + /// [`TryFuture](futures_core::future::TryFuture). fn never_error(self) -> NeverError where Self: Sized { diff --git a/futures-util/src/future/never_error.rs b/futures-util/src/future/never_error.rs index 8924ec6ceb..6e8094c118 100644 --- a/futures-util/src/future/never_error.rs +++ b/futures-util/src/future/never_error.rs @@ -1,6 +1,7 @@ use core::pin::Pin; use futures_core::future::{FusedFuture, Future}; use futures_core::task::{self, Poll}; +use futures_core::never::Never; use pin_utils::unsafe_pinned; /// Future for the [`never_error`](super::FutureExt::never_error) combinator. @@ -27,9 +28,9 @@ impl FusedFuture for NeverError { impl Future for NeverError where Fut: Future, { - type Output = Result; + type Output = Result; - fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll> { + fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll { self.future().poll(cx).map(Ok) } } diff --git a/futures-util/src/lib.rs b/futures-util/src/lib.rs index b2308b32bc..e234003a98 100644 --- a/futures-util/src/lib.rs +++ b/futures-util/src/lib.rs @@ -3,7 +3,6 @@ #![cfg_attr(feature = "async-await", feature(async_await))] #![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))] -#![cfg_attr(feature = "never-type", feature(never_type))] #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)] @@ -18,9 +17,6 @@ #[cfg(all(feature = "cfg-target-has-atomic", not(feature = "nightly")))] compile_error!("The `cfg-target-has-atomic` feature requires the `nightly` feature as an explicit opt-in to unstable features"); -#[cfg(all(feature = "never-type", not(feature = "nightly")))] -compile_error!("The `never-type` feature requires the `nightly` feature as an explicit opt-in to unstable features"); - #[cfg(all(feature = "async-await", not(feature = "nightly")))] compile_error!("The `async-await` feature requires the `nightly` feature as an explicit opt-in to unstable features"); diff --git a/futures/Cargo.toml b/futures/Cargo.toml index 856b5e26c7..48bcb67988 100644 --- a/futures/Cargo.toml +++ b/futures/Cargo.toml @@ -44,7 +44,6 @@ default = ["std"] compat = ["std", "futures-util-preview/compat"] io-compat = ["compat", "futures-util-preview/io-compat"] cfg-target-has-atomic = ["futures-core-preview/cfg-target-has-atomic", "futures-util-preview/cfg-target-has-atomic"] -never-type = ["futures-util-preview/never-type"] alloc = ["futures-core-preview/alloc", "futures-sink-preview/alloc", "futures-util-preview/alloc"] [package.metadata.docs.rs] diff --git a/futures/src/lib.rs b/futures/src/lib.rs index eed533b44f..b29dcc48eb 100644 --- a/futures/src/lib.rs +++ b/futures/src/lib.rs @@ -22,7 +22,6 @@ //! completion, but *do not block* the thread running them. #![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))] -#![cfg_attr(feature = "never-type", feature(never_type))] #![cfg_attr(not(feature = "std"), no_std)] @@ -41,9 +40,6 @@ compile_error!("The `async-await` feature requires the `nightly` feature as an e #[cfg(all(feature = "cfg-target-has-atomic", not(feature = "nightly")))] compile_error!("The `cfg-target-has-atomic` feature requires the `nightly` feature as an explicit opt-in to unstable features"); -#[cfg(all(feature = "never-type", not(feature = "nightly")))] -compile_error!("The `never-type` feature requires the `nightly` feature as an explicit opt-in to unstable features"); - #[doc(hidden)] pub use futures_core::core_reexport; #[doc(hidden)] pub use futures_core::future::Future; @@ -227,6 +223,7 @@ pub mod future { FutureExt, FlattenStream, Flatten, Fuse, Inspect, IntoStream, Map, Then, UnitError, + NeverError, }; #[cfg(feature = "alloc")] @@ -261,9 +258,6 @@ pub mod future { InspectOk, InspectErr, TryFlattenStream, UnwrapOrElse, }; - #[cfg(feature = "never-type")] - pub use futures_util::future::NeverError; - #[cfg(feature = "alloc")] pub use futures_util::try_future::{ try_join_all, TryJoinAll,