diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c243e4a6fd..a3d83fb059 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: # Check thread-pool feature (futures, futures-executor) - run: cargo hack build -p futures -p futures-executor --no-default-features --features std,thread-pool - build: + async-await-msrv: name: cargo +${{ matrix.rust }} build strategy: matrix: @@ -102,6 +102,19 @@ jobs: # This is the minimum Rust version supported by `async-await` feature. # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md. - 1.39.0 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - run: cargo install cargo-hack + - run: cargo hack build --workspace --no-dev-deps + + build: + name: cargo +${{ matrix.rust }} build + strategy: + matrix: + rust: - stable - beta - nightly diff --git a/futures/Cargo.toml b/futures/Cargo.toml index 34ca82e809..b8a51b3dc2 100644 --- a/futures/Cargo.toml +++ b/futures/Cargo.toml @@ -25,12 +25,13 @@ futures-sink = { path = "../futures-sink", version = "0.3.12", default-features futures-util = { path = "../futures-util", version = "0.3.12", default-features = false, features = ["sink"] } [dev-dependencies] -pin-utils = "0.1.0" futures-executor = { path = "../futures-executor", features = ["thread-pool"] } futures-test = { path = "../futures-test" } -tokio = "0.1.11" assert_matches = "1.3.0" pin-project = "1.0.1" +pin-utils = "0.1.0" +static_assertions = "1" +tokio = "0.1.11" [features] default = ["std", "async-await", "executor"] diff --git a/futures/tests/auto_traits.rs b/futures/tests/auto_traits.rs new file mode 100644 index 0000000000..9346ea35c1 --- /dev/null +++ b/futures/tests/auto_traits.rs @@ -0,0 +1,1826 @@ +//! Assert Send/Sync/Unpin for all public types. + +use futures::{ + future::Future, + sink::Sink, + stream::Stream, + task::{Context, Poll}, +}; +use static_assertions::{assert_impl_all as assert_impl, assert_not_impl_all as assert_not_impl}; +use std::marker::PhantomPinned; +use std::{marker::PhantomData, pin::Pin}; + +pub type LocalFuture = Pin>>; +pub type LocalTryFuture = LocalFuture>; +pub type SendFuture = Pin + Send>>; +pub type SendTryFuture = SendFuture>; +pub type SyncFuture = Pin + Sync>>; +pub type SyncTryFuture = SyncFuture>; +pub type UnpinFuture = LocalFuture; +pub type UnpinTryFuture = UnpinFuture>; +pub struct PinnedFuture(PhantomPinned, PhantomData); +impl Future for PinnedFuture { + type Output = T; + fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { + unimplemented!() + } +} +pub type PinnedTryFuture = PinnedFuture>; + +pub type LocalStream = Pin>>; +pub type LocalTryStream = LocalStream>; +pub type SendStream = Pin + Send>>; +pub type SendTryStream = SendStream>; +pub type SyncStream = Pin + Sync>>; +pub type SyncTryStream = SyncStream>; +pub type UnpinStream = LocalStream; +pub type UnpinTryStream = UnpinStream>; +pub struct PinnedStream(PhantomPinned, PhantomData); +impl Stream for PinnedStream { + type Item = T; + fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { + unimplemented!() + } +} +pub type PinnedTryStream = PinnedStream>; + +pub type LocalSink = Pin>>; +pub type SendSink = Pin + Send>>; +pub type SyncSink = Pin + Sync>>; +pub type UnpinSink = LocalSink; +pub struct PinnedSink(PhantomPinned, PhantomData<(T, E)>); +impl Sink for PinnedSink { + type Error = E; + fn poll_ready(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { + unimplemented!() + } + fn start_send(self: Pin<&mut Self>, _: T) -> Result<(), Self::Error> { + unimplemented!() + } + fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { + unimplemented!() + } + fn poll_close(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { + unimplemented!() + } +} + +/// Assert Send/Sync/Unpin for all public types in `futures::channel`. +pub mod channel { + use super::*; + use futures::channel::*; + + assert_impl!(mpsc::Receiver<()>: Send); + assert_not_impl!(mpsc::Receiver<*const ()>: Send); + assert_impl!(mpsc::Receiver<()>: Sync); + assert_not_impl!(mpsc::Receiver<*const ()>: Sync); + assert_impl!(mpsc::Receiver: Unpin); + + assert_impl!(mpsc::SendError: Send); + assert_impl!(mpsc::SendError: Sync); + assert_impl!(mpsc::SendError: Unpin); + + assert_impl!(mpsc::Sender<()>: Send); + assert_not_impl!(mpsc::Sender<*const ()>: Send); + assert_impl!(mpsc::Sender<()>: Sync); + assert_not_impl!(mpsc::Sender<*const ()>: Sync); + assert_impl!(mpsc::Sender: Unpin); + + assert_impl!(mpsc::TryRecvError: Send); + assert_impl!(mpsc::TryRecvError: Sync); + assert_impl!(mpsc::TryRecvError: Unpin); + + assert_impl!(mpsc::TrySendError<()>: Send); + assert_not_impl!(mpsc::TrySendError<*const ()>: Send); + assert_impl!(mpsc::TrySendError<()>: Sync); + assert_not_impl!(mpsc::TrySendError<*const ()>: Sync); + assert_impl!(mpsc::TrySendError<()>: Unpin); + assert_not_impl!(mpsc::TrySendError: Unpin); + + assert_impl!(mpsc::UnboundedReceiver<()>: Send); + assert_not_impl!(mpsc::UnboundedReceiver<*const ()>: Send); + assert_impl!(mpsc::UnboundedReceiver<()>: Sync); + assert_not_impl!(mpsc::UnboundedReceiver<*const ()>: Sync); + assert_impl!(mpsc::UnboundedReceiver: Unpin); + + assert_impl!(mpsc::UnboundedReceiver<()>: Send); + assert_not_impl!(mpsc::UnboundedReceiver<*const ()>: Send); + assert_impl!(mpsc::UnboundedReceiver<()>: Sync); + assert_not_impl!(mpsc::UnboundedReceiver<*const ()>: Sync); + assert_impl!(mpsc::UnboundedReceiver: Unpin); + + assert_impl!(oneshot::Canceled: Send); + assert_impl!(oneshot::Canceled: Sync); + assert_impl!(oneshot::Canceled: Unpin); + + assert_impl!(oneshot::Cancellation<()>: Send); + assert_not_impl!(oneshot::Cancellation<*const ()>: Send); + assert_impl!(oneshot::Cancellation<()>: Sync); + assert_not_impl!(oneshot::Cancellation<*const ()>: Sync); + assert_impl!(oneshot::Cancellation: Unpin); + + assert_impl!(oneshot::Receiver<()>: Send); + assert_not_impl!(oneshot::Receiver<*const ()>: Send); + assert_impl!(oneshot::Receiver<()>: Sync); + assert_not_impl!(oneshot::Receiver<*const ()>: Sync); + assert_impl!(oneshot::Receiver: Unpin); + + assert_impl!(oneshot::Sender<()>: Send); + assert_not_impl!(oneshot::Sender<*const ()>: Send); + assert_impl!(oneshot::Sender<()>: Sync); + assert_not_impl!(oneshot::Sender<*const ()>: Sync); + assert_impl!(oneshot::Sender: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::compat`. +pub mod compat { + use super::*; + use futures::compat::*; + + assert_impl!(Compat<()>: Send); + assert_not_impl!(Compat<*const ()>: Send); + assert_impl!(Compat<()>: Sync); + assert_not_impl!(Compat<*const ()>: Sync); + assert_impl!(Compat<()>: Unpin); + assert_not_impl!(Compat: Unpin); + + assert_impl!(Compat01As03<()>: Send); + assert_not_impl!(Compat01As03<*const ()>: Send); + assert_not_impl!(Compat01As03<()>: Sync); + assert_impl!(Compat01As03: Unpin); + + assert_impl!(Compat01As03Sink<(), ()>: Send); + assert_not_impl!(Compat01As03Sink<(), *const ()>: Send); + assert_not_impl!(Compat01As03Sink<*const (), ()>: Send); + assert_not_impl!(Compat01As03Sink<(), ()>: Sync); + assert_impl!(Compat01As03Sink: Unpin); + + assert_impl!(CompatSink<(), *const ()>: Send); + assert_not_impl!(CompatSink<*const (), ()>: Send); + assert_impl!(CompatSink<(), *const ()>: Sync); + assert_not_impl!(CompatSink<*const (), ()>: Sync); + assert_impl!(CompatSink<(), PhantomPinned>: Unpin); + assert_not_impl!(CompatSink: Unpin); + + assert_impl!(Executor01As03<()>: Send); + assert_not_impl!(Executor01As03<*const ()>: Send); + assert_impl!(Executor01As03<()>: Sync); + assert_not_impl!(Executor01As03<*const ()>: Sync); + assert_impl!(Executor01As03<()>: Unpin); + assert_not_impl!(Executor01As03: Unpin); + + assert_impl!(Executor01Future: Send); + assert_not_impl!(Executor01Future: Sync); + assert_impl!(Executor01Future: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::executor`. +pub mod executor { + use super::*; + use futures::executor::*; + + assert_impl!(BlockingStream: Send); + assert_not_impl!(BlockingStream: Send); + assert_impl!(BlockingStream: Sync); + assert_not_impl!(BlockingStream: Sync); + assert_impl!(BlockingStream: Unpin); + // BlockingStream requires `S: Unpin` + // assert_not_impl!(BlockingStream: Unpin); + + assert_impl!(Enter: Send); + assert_impl!(Enter: Sync); + assert_impl!(Enter: Unpin); + + assert_impl!(EnterError: Send); + assert_impl!(EnterError: Sync); + assert_impl!(EnterError: Unpin); + + assert_not_impl!(LocalPool: Send); + assert_not_impl!(LocalPool: Sync); + assert_impl!(LocalPool: Unpin); + + assert_not_impl!(LocalSpawner: Send); + assert_not_impl!(LocalSpawner: Sync); + assert_impl!(LocalSpawner: Unpin); + + assert_impl!(ThreadPool: Send); + assert_impl!(ThreadPool: Sync); + assert_impl!(ThreadPool: Unpin); + + assert_impl!(ThreadPoolBuilder: Send); + assert_impl!(ThreadPoolBuilder: Sync); + assert_impl!(ThreadPoolBuilder: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::future`. +pub mod future { + use super::*; + use futures::future::*; + + assert_impl!(AbortHandle: Send); + assert_impl!(AbortHandle: Sync); + assert_impl!(AbortHandle: Unpin); + + assert_impl!(AbortRegistration: Send); + assert_impl!(AbortRegistration: Sync); + assert_impl!(AbortRegistration: Unpin); + + assert_impl!(Abortable: Send); + assert_not_impl!(Abortable: Send); + assert_impl!(Abortable: Sync); + assert_not_impl!(Abortable: Sync); + assert_impl!(Abortable: Unpin); + assert_not_impl!(Abortable: Unpin); + + assert_impl!(Aborted: Send); + assert_impl!(Aborted: Sync); + assert_impl!(Aborted: Unpin); + + assert_impl!(AndThen: Send); + assert_not_impl!(AndThen: Send); + assert_not_impl!(AndThen: Send); + assert_not_impl!(AndThen: Send); + assert_impl!(AndThen: Sync); + assert_not_impl!(AndThen: Sync); + assert_not_impl!(AndThen: Sync); + assert_not_impl!(AndThen: Sync); + assert_impl!(AndThen: Unpin); + assert_not_impl!(AndThen: Unpin); + assert_not_impl!(AndThen: Unpin); + + assert_impl!(CatchUnwind: Send); + assert_not_impl!(CatchUnwind: Send); + assert_impl!(CatchUnwind: Sync); + assert_not_impl!(CatchUnwind: Sync); + assert_impl!(CatchUnwind: Unpin); + assert_not_impl!(CatchUnwind: Unpin); + + assert_impl!(ErrInto: Send); + assert_not_impl!(ErrInto: Send); + assert_impl!(ErrInto: Sync); + assert_not_impl!(ErrInto: Sync); + assert_impl!(ErrInto: Unpin); + assert_not_impl!(ErrInto: Unpin); + + assert_impl!(Flatten>: Send); + assert_not_impl!(Flatten: Send); + assert_not_impl!(Flatten: Send); + assert_impl!(Flatten>: Sync); + assert_not_impl!(Flatten: Sync); + assert_not_impl!(Flatten: Sync); + assert_impl!(Flatten>: Unpin); + assert_not_impl!(Flatten: Unpin); + assert_not_impl!(Flatten: Unpin); + + assert_impl!(FlattenSink: Send); + assert_not_impl!(FlattenSink: Send); + assert_not_impl!(FlattenSink: Send); + assert_impl!(FlattenSink: Sync); + assert_not_impl!(FlattenSink: Sync); + assert_not_impl!(FlattenSink: Sync); + assert_impl!(FlattenSink: Unpin); + assert_not_impl!(FlattenSink: Unpin); + assert_not_impl!(FlattenSink: Unpin); + + assert_impl!(FlattenStream>: Send); + assert_not_impl!(FlattenStream: Send); + assert_not_impl!(FlattenStream: Send); + assert_impl!(FlattenStream>: Sync); + assert_not_impl!(FlattenStream: Sync); + assert_not_impl!(FlattenStream: Sync); + assert_impl!(FlattenStream>: Unpin); + assert_not_impl!(FlattenStream: Unpin); + assert_not_impl!(FlattenStream: Unpin); + + assert_impl!(Fuse: Send); + assert_not_impl!(Fuse: Send); + assert_impl!(Fuse: Sync); + assert_not_impl!(Fuse: Sync); + assert_impl!(Fuse: Unpin); + assert_not_impl!(Fuse: Unpin); + + assert_impl!(FutureObj<*const ()>: Send); + assert_not_impl!(FutureObj<()>: Sync); + assert_impl!(FutureObj: Unpin); + + assert_impl!(Inspect: Send); + assert_not_impl!(Inspect: Send); + assert_not_impl!(Inspect: Send); + assert_impl!(Inspect: Sync); + assert_not_impl!(Inspect: Sync); + assert_not_impl!(Inspect: Sync); + assert_impl!(Inspect: Unpin); + assert_not_impl!(Inspect: Unpin); + + assert_impl!(InspectErr: Send); + assert_not_impl!(InspectErr: Send); + assert_not_impl!(InspectErr: Send); + assert_impl!(InspectErr: Sync); + assert_not_impl!(InspectErr: Sync); + assert_not_impl!(InspectErr: Sync); + assert_impl!(InspectErr: Unpin); + assert_not_impl!(InspectErr: Unpin); + + assert_impl!(InspectOk: Send); + assert_not_impl!(InspectOk: Send); + assert_not_impl!(InspectOk: Send); + assert_impl!(InspectOk: Sync); + assert_not_impl!(InspectOk: Sync); + assert_not_impl!(InspectOk: Sync); + assert_impl!(InspectOk: Unpin); + assert_not_impl!(InspectOk: Unpin); + + assert_impl!(IntoFuture: Send); + assert_not_impl!(IntoFuture: Send); + assert_impl!(IntoFuture: Sync); + assert_not_impl!(IntoFuture: Sync); + assert_impl!(IntoFuture: Unpin); + assert_not_impl!(IntoFuture: Unpin); + + assert_impl!(IntoStream: Send); + assert_not_impl!(IntoStream: Send); + assert_impl!(IntoStream: Sync); + assert_not_impl!(IntoStream: Sync); + assert_impl!(IntoStream: Unpin); + assert_not_impl!(IntoStream: Unpin); + + assert_impl!(Join, SendFuture<()>>: Send); + assert_not_impl!(Join, SendFuture>: Send); + assert_not_impl!(Join>: Send); + assert_not_impl!(Join: Send); + assert_not_impl!(Join: Send); + assert_impl!(Join, SyncFuture<()>>: Sync); + assert_not_impl!(Join, SyncFuture>: Sync); + assert_not_impl!(Join>: Sync); + assert_not_impl!(Join: Sync); + assert_not_impl!(Join: Sync); + assert_impl!(Join: Unpin); + assert_not_impl!(Join: Unpin); + assert_not_impl!(Join: Unpin); + + // Join3, Join4, Join5 are the same as Join + + assert_impl!(JoinAll>: Send); + assert_not_impl!(JoinAll: Send); + assert_not_impl!(JoinAll: Send); + assert_impl!(JoinAll>: Sync); + assert_not_impl!(JoinAll: Sync); + assert_not_impl!(JoinAll: Sync); + assert_impl!(JoinAll: Unpin); + + assert_impl!(Lazy<()>: Send); + assert_not_impl!(Lazy<*const ()>: Send); + assert_impl!(Lazy<()>: Sync); + assert_not_impl!(Lazy<*const ()>: Sync); + assert_impl!(Lazy: Unpin); + + assert_not_impl!(LocalFutureObj<()>: Send); + assert_not_impl!(LocalFutureObj<()>: Sync); + assert_impl!(LocalFutureObj: Unpin); + + assert_impl!(Map: Send); + assert_not_impl!(Map: Send); + assert_not_impl!(Map: Send); + assert_impl!(Map: Sync); + assert_not_impl!(Map: Sync); + assert_not_impl!(Map: Sync); + assert_impl!(Map: Unpin); + assert_not_impl!(Map: Unpin); + + assert_impl!(MapErr: Send); + assert_not_impl!(MapErr: Send); + assert_not_impl!(MapErr: Send); + assert_impl!(MapErr: Sync); + assert_not_impl!(MapErr: Sync); + assert_not_impl!(MapErr: Sync); + assert_impl!(MapErr: Unpin); + assert_not_impl!(MapErr: Unpin); + + assert_impl!(MapInto: Send); + assert_not_impl!(MapInto: Send); + assert_impl!(MapInto: Sync); + assert_not_impl!(MapInto: Sync); + assert_impl!(MapInto: Unpin); + assert_not_impl!(MapInto: Unpin); + + assert_impl!(MapOk: Send); + assert_not_impl!(MapOk: Send); + assert_not_impl!(MapOk: Send); + assert_impl!(MapOk: Sync); + assert_not_impl!(MapOk: Sync); + assert_not_impl!(MapOk: Sync); + assert_impl!(MapOk: Unpin); + assert_not_impl!(MapOk: Unpin); + + assert_impl!(MapOkOrElse: Send); + assert_not_impl!(MapOkOrElse: Send); + assert_not_impl!(MapOkOrElse: Send); + assert_not_impl!(MapOkOrElse: Send); + assert_impl!(MapOkOrElse: Sync); + assert_not_impl!(MapOkOrElse: Sync); + assert_not_impl!(MapOkOrElse: Sync); + assert_not_impl!(MapOkOrElse: Sync); + assert_impl!(MapOkOrElse: Unpin); + assert_not_impl!(MapOkOrElse: Unpin); + + assert_impl!(NeverError: Send); + assert_not_impl!(NeverError: Send); + assert_impl!(NeverError: Sync); + assert_not_impl!(NeverError: Sync); + assert_impl!(NeverError: Unpin); + assert_not_impl!(NeverError: Unpin); + + assert_impl!(OkInto: Send); + assert_not_impl!(OkInto: Send); + assert_impl!(OkInto: Sync); + assert_not_impl!(OkInto: Sync); + assert_impl!(OkInto: Unpin); + assert_not_impl!(OkInto: Unpin); + + assert_impl!(OptionFuture: Send); + assert_not_impl!(OptionFuture: Send); + assert_impl!(OptionFuture: Sync); + assert_not_impl!(OptionFuture: Sync); + assert_impl!(OptionFuture: Unpin); + assert_not_impl!(OptionFuture: Unpin); + + assert_impl!(OrElse: Send); + assert_not_impl!(OrElse: Send); + assert_not_impl!(OrElse: Send); + assert_not_impl!(OrElse: Send); + assert_impl!(OrElse: Sync); + assert_not_impl!(OrElse: Sync); + assert_not_impl!(OrElse: Sync); + assert_not_impl!(OrElse: Sync); + assert_impl!(OrElse: Unpin); + assert_not_impl!(OrElse: Unpin); + assert_not_impl!(OrElse: Unpin); + + assert_impl!(Pending<()>: Send); + assert_not_impl!(Pending<*const ()>: Send); + assert_impl!(Pending<()>: Sync); + assert_not_impl!(Pending<*const ()>: Sync); + assert_impl!(Pending: Unpin); + + assert_impl!(PollFn<()>: Send); + assert_not_impl!(PollFn<*const ()>: Send); + assert_impl!(PollFn<()>: Sync); + assert_not_impl!(PollFn<*const ()>: Sync); + assert_impl!(PollFn: Unpin); + + assert_impl!(Ready<()>: Send); + assert_not_impl!(Ready<*const ()>: Send); + assert_impl!(Ready<()>: Sync); + assert_not_impl!(Ready<*const ()>: Sync); + assert_impl!(Ready: Unpin); + + assert_impl!(Remote>: Send); + assert_not_impl!(Remote: Send); + assert_not_impl!(Remote: Send); + assert_impl!(Remote>: Sync); + assert_not_impl!(Remote: Sync); + assert_not_impl!(Remote: Sync); + assert_impl!(Remote: Unpin); + assert_not_impl!(Remote: Unpin); + + assert_impl!(RemoteHandle<()>: Send); + assert_not_impl!(RemoteHandle<*const ()>: Send); + assert_impl!(RemoteHandle<()>: Sync); + assert_not_impl!(RemoteHandle<*const ()>: Sync); + assert_impl!(RemoteHandle: Unpin); + + assert_impl!(Select: Send); + assert_not_impl!(Select: Send); + assert_not_impl!(Select: Send); + assert_impl!(Select: Sync); + assert_not_impl!(Select: Sync); + assert_not_impl!(Select: Sync); + assert_impl!(Select: Unpin); + assert_not_impl!(Select: Unpin); + assert_not_impl!(Select: Unpin); + + assert_impl!(SelectAll: Send); + assert_not_impl!(SelectAll: Send); + assert_impl!(SelectAll: Sync); + assert_not_impl!(SelectAll: Sync); + assert_impl!(SelectAll: Unpin); + assert_not_impl!(SelectAll: Unpin); + + assert_impl!(SelectOk: Send); + assert_not_impl!(SelectOk: Send); + assert_impl!(SelectOk: Sync); + assert_not_impl!(SelectOk: Sync); + assert_impl!(SelectOk: Unpin); + assert_not_impl!(SelectOk: Unpin); + + assert_impl!(Shared>: Send); + assert_not_impl!(Shared: Send); + assert_not_impl!(Shared: Send); + assert_not_impl!(Shared>: Sync); + assert_impl!(Shared: Unpin); + + assert_impl!(Then: Send); + assert_not_impl!(Then: Send); + assert_not_impl!(Then: Send); + assert_not_impl!(Then: Send); + assert_impl!(Then: Sync); + assert_not_impl!(Then: Sync); + assert_not_impl!(Then: Sync); + assert_not_impl!(Then: Sync); + assert_impl!(Then: Unpin); + assert_not_impl!(Then: Unpin); + assert_not_impl!(Then: Unpin); + + assert_impl!(TryFlatten, ()>: Send); + assert_not_impl!(TryFlatten: Send); + assert_not_impl!(TryFlatten: Send); + assert_impl!(TryFlatten, ()>: Sync); + assert_not_impl!(TryFlatten: Sync); + assert_not_impl!(TryFlatten: Sync); + assert_impl!(TryFlatten, ()>: Unpin); + assert_not_impl!(TryFlatten: Unpin); + assert_not_impl!(TryFlatten: Unpin); + + assert_impl!(TryFlattenStream>: Send); + assert_not_impl!(TryFlattenStream: Send); + assert_not_impl!(TryFlattenStream: Send); + assert_impl!(TryFlattenStream>: Sync); + assert_not_impl!(TryFlattenStream: Sync); + assert_not_impl!(TryFlattenStream: Sync); + assert_impl!(TryFlattenStream>: Unpin); + assert_not_impl!(TryFlattenStream: Unpin); + assert_not_impl!(TryFlattenStream: Unpin); + + assert_impl!(TryJoin, SendTryFuture<()>>: Send); + assert_not_impl!(TryJoin, SendTryFuture>: Send); + assert_not_impl!(TryJoin>: Send); + assert_not_impl!(TryJoin: Send); + assert_not_impl!(TryJoin: Send); + assert_impl!(TryJoin, SyncTryFuture<()>>: Sync); + assert_not_impl!(TryJoin, SyncTryFuture>: Sync); + assert_not_impl!(TryJoin>: Sync); + assert_not_impl!(TryJoin: Sync); + assert_not_impl!(TryJoin: Sync); + assert_impl!(TryJoin: Unpin); + assert_not_impl!(TryJoin: Unpin); + assert_not_impl!(TryJoin: Unpin); + + // TryJoin3, TryJoin4, TryJoin5 are the same as TryJoin + + assert_impl!(TryJoinAll>: Send); + assert_not_impl!(TryJoinAll: Send); + assert_not_impl!(TryJoinAll: Send); + assert_impl!(TryJoinAll>: Sync); + assert_not_impl!(TryJoinAll: Sync); + assert_not_impl!(TryJoinAll: Sync); + assert_impl!(TryJoinAll: Unpin); + + assert_impl!(TrySelect: Send); + assert_not_impl!(TrySelect: Send); + assert_not_impl!(TrySelect: Send); + assert_impl!(TrySelect: Sync); + assert_not_impl!(TrySelect: Sync); + assert_not_impl!(TrySelect: Sync); + assert_impl!(TrySelect: Unpin); + assert_not_impl!(TrySelect: Unpin); + assert_not_impl!(TrySelect: Unpin); + + assert_impl!(UnitError: Send); + assert_not_impl!(UnitError: Send); + assert_impl!(UnitError: Sync); + assert_not_impl!(UnitError: Sync); + assert_impl!(UnitError: Unpin); + assert_not_impl!(UnitError: Unpin); + + assert_impl!(UnwrapOrElse: Send); + assert_not_impl!(UnwrapOrElse: Send); + assert_not_impl!(UnwrapOrElse: Send); + assert_impl!(UnwrapOrElse: Sync); + assert_not_impl!(UnwrapOrElse: Sync); + assert_not_impl!(UnwrapOrElse: Sync); + assert_impl!(UnwrapOrElse: Unpin); + assert_not_impl!(UnwrapOrElse: Unpin); + + assert_impl!(WeakShared>: Send); + assert_not_impl!(WeakShared: Send); + assert_not_impl!(WeakShared: Send); + assert_not_impl!(WeakShared>: Sync); + assert_impl!(WeakShared: Unpin); + + assert_impl!(Either: Send); + assert_not_impl!(Either: Send); + assert_not_impl!(Either: Send); + assert_impl!(Either: Sync); + assert_not_impl!(Either: Sync); + assert_not_impl!(Either: Sync); + assert_impl!(Either: Unpin); + assert_not_impl!(Either: Unpin); + assert_not_impl!(Either: Unpin); + + assert_impl!(MaybeDone>: Send); + assert_not_impl!(MaybeDone: Send); + assert_not_impl!(MaybeDone: Send); + assert_impl!(MaybeDone>: Sync); + assert_not_impl!(MaybeDone: Sync); + assert_not_impl!(MaybeDone: Sync); + assert_impl!(MaybeDone: Unpin); + assert_not_impl!(MaybeDone: Unpin); + + assert_impl!(TryMaybeDone>: Send); + assert_not_impl!(TryMaybeDone: Send); + assert_not_impl!(TryMaybeDone: Send); + assert_impl!(TryMaybeDone>: Sync); + assert_not_impl!(TryMaybeDone: Sync); + assert_not_impl!(TryMaybeDone: Sync); + assert_impl!(TryMaybeDone: Unpin); + assert_not_impl!(TryMaybeDone: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::io`. +pub mod io { + use super::*; + use futures::io::{Sink, *}; + + assert_impl!(AllowStdIo<()>: Send); + assert_not_impl!(AllowStdIo<*const ()>: Send); + assert_impl!(AllowStdIo<()>: Sync); + assert_not_impl!(AllowStdIo<*const ()>: Sync); + assert_impl!(AllowStdIo: Unpin); + + assert_impl!(BufReader<()>: Send); + assert_not_impl!(BufReader<*const ()>: Send); + assert_impl!(BufReader<()>: Sync); + assert_not_impl!(BufReader<*const ()>: Sync); + assert_impl!(BufReader<()>: Unpin); + assert_not_impl!(BufReader: Unpin); + + assert_impl!(BufWriter<()>: Send); + assert_not_impl!(BufWriter<*const ()>: Send); + assert_impl!(BufWriter<()>: Sync); + assert_not_impl!(BufWriter<*const ()>: Sync); + assert_impl!(BufWriter<()>: Unpin); + assert_not_impl!(BufWriter: Unpin); + + assert_impl!(Chain<(), ()>: Send); + assert_not_impl!(Chain<(), *const ()>: Send); + assert_not_impl!(Chain<*const (), ()>: Send); + assert_impl!(Chain<(), ()>: Sync); + assert_not_impl!(Chain<(), *const ()>: Sync); + assert_not_impl!(Chain<*const (), ()>: Sync); + assert_impl!(Chain<(), ()>: Unpin); + assert_not_impl!(Chain<(), PhantomPinned>: Unpin); + assert_not_impl!(Chain: Unpin); + + assert_impl!(Close<'_, ()>: Send); + assert_not_impl!(Close<'_, *const ()>: Send); + assert_impl!(Close<'_, ()>: Sync); + assert_not_impl!(Close<'_, *const ()>: Sync); + assert_impl!(Close<'_, ()>: Unpin); + assert_not_impl!(Close<'_, PhantomPinned>: Unpin); + + assert_impl!(Copy<(), ()>: Send); + assert_not_impl!(Copy<(), *const ()>: Send); + assert_not_impl!(Copy<*const (), ()>: Send); + assert_impl!(Copy<(), ()>: Sync); + assert_not_impl!(Copy<(), *const ()>: Sync); + assert_not_impl!(Copy<*const (), ()>: Sync); + assert_impl!(Copy<(), PhantomPinned>: Unpin); + assert_not_impl!(Copy: Unpin); + + assert_impl!(CopyBuf<(), ()>: Send); + assert_not_impl!(CopyBuf<(), *const ()>: Send); + assert_not_impl!(CopyBuf<*const (), ()>: Send); + assert_impl!(CopyBuf<(), ()>: Sync); + assert_not_impl!(CopyBuf<(), *const ()>: Sync); + assert_not_impl!(CopyBuf<*const (), ()>: Sync); + assert_impl!(CopyBuf<(), PhantomPinned>: Unpin); + assert_not_impl!(CopyBuf: Unpin); + + assert_impl!(Cursor<()>: Send); + assert_not_impl!(Cursor<*const ()>: Send); + assert_impl!(Cursor<()>: Sync); + assert_not_impl!(Cursor<*const ()>: Sync); + assert_impl!(Cursor<()>: Unpin); + assert_not_impl!(Cursor: Unpin); + + assert_impl!(Empty: Send); + assert_impl!(Empty: Sync); + assert_impl!(Empty: Unpin); + + assert_impl!(FillBuf<'_, ()>: Send); + assert_not_impl!(FillBuf<'_, *const ()>: Send); + assert_impl!(FillBuf<'_, ()>: Sync); + assert_not_impl!(FillBuf<'_, *const ()>: Sync); + assert_impl!(FillBuf<'_, PhantomPinned>: Unpin); + + assert_impl!(Flush<'_, ()>: Send); + assert_not_impl!(Flush<'_, *const ()>: Send); + assert_impl!(Flush<'_, ()>: Sync); + assert_not_impl!(Flush<'_, *const ()>: Sync); + assert_impl!(Flush<'_, ()>: Unpin); + assert_not_impl!(Flush<'_, PhantomPinned>: Unpin); + + assert_impl!(IntoSink<(), ()>: Send); + assert_not_impl!(IntoSink<(), *const ()>: Send); + assert_not_impl!(IntoSink<*const (), ()>: Send); + assert_impl!(IntoSink<(), ()>: Sync); + assert_not_impl!(IntoSink<(), *const ()>: Sync); + assert_not_impl!(IntoSink<*const (), ()>: Sync); + assert_impl!(IntoSink<(), PhantomPinned>: Unpin); + assert_not_impl!(IntoSink: Unpin); + + assert_impl!(Lines<()>: Send); + assert_not_impl!(Lines<*const ()>: Send); + assert_impl!(Lines<()>: Sync); + assert_not_impl!(Lines<*const ()>: Sync); + assert_impl!(Lines<()>: Unpin); + assert_not_impl!(Lines: Unpin); + + assert_impl!(Read<'_, ()>: Send); + assert_not_impl!(Read<'_, *const ()>: Send); + assert_impl!(Read<'_, ()>: Sync); + assert_not_impl!(Read<'_, *const ()>: Sync); + assert_impl!(Read<'_, ()>: Unpin); + assert_not_impl!(Read<'_, PhantomPinned>: Unpin); + + assert_impl!(ReadExact<'_, ()>: Send); + assert_not_impl!(ReadExact<'_, *const ()>: Send); + assert_impl!(ReadExact<'_, ()>: Sync); + assert_not_impl!(ReadExact<'_, *const ()>: Sync); + assert_impl!(ReadExact<'_, ()>: Unpin); + assert_not_impl!(ReadExact<'_, PhantomPinned>: Unpin); + + assert_impl!(ReadHalf<()>: Send); + assert_not_impl!(ReadHalf<*const ()>: Send); + assert_impl!(ReadHalf<()>: Sync); + assert_not_impl!(ReadHalf<*const ()>: Sync); + assert_impl!(ReadHalf: Unpin); + + assert_impl!(ReadLine<'_, ()>: Send); + assert_not_impl!(ReadLine<'_, *const ()>: Send); + assert_impl!(ReadLine<'_, ()>: Sync); + assert_not_impl!(ReadLine<'_, *const ()>: Sync); + assert_impl!(ReadLine<'_, ()>: Unpin); + assert_not_impl!(ReadLine<'_, PhantomPinned>: Unpin); + + assert_impl!(ReadToEnd<'_, ()>: Send); + assert_not_impl!(ReadToEnd<'_, *const ()>: Send); + assert_impl!(ReadToEnd<'_, ()>: Sync); + assert_not_impl!(ReadToEnd<'_, *const ()>: Sync); + assert_impl!(ReadToEnd<'_, ()>: Unpin); + assert_not_impl!(ReadToEnd<'_, PhantomPinned>: Unpin); + + assert_impl!(ReadToString<'_, ()>: Send); + assert_not_impl!(ReadToString<'_, *const ()>: Send); + assert_impl!(ReadToString<'_, ()>: Sync); + assert_not_impl!(ReadToString<'_, *const ()>: Sync); + assert_impl!(ReadToString<'_, ()>: Unpin); + assert_not_impl!(ReadToString<'_, PhantomPinned>: Unpin); + + assert_impl!(ReadUntil<'_, ()>: Send); + assert_not_impl!(ReadUntil<'_, *const ()>: Send); + assert_impl!(ReadUntil<'_, ()>: Sync); + assert_not_impl!(ReadUntil<'_, *const ()>: Sync); + assert_impl!(ReadUntil<'_, ()>: Unpin); + assert_not_impl!(ReadUntil<'_, PhantomPinned>: Unpin); + + assert_impl!(ReadVectored<'_, ()>: Send); + assert_not_impl!(ReadVectored<'_, *const ()>: Send); + assert_impl!(ReadVectored<'_, ()>: Sync); + assert_not_impl!(ReadVectored<'_, *const ()>: Sync); + assert_impl!(ReadVectored<'_, ()>: Unpin); + assert_not_impl!(ReadVectored<'_, PhantomPinned>: Unpin); + + assert_impl!(Repeat: Send); + assert_impl!(Repeat: Sync); + assert_impl!(Repeat: Unpin); + + assert_impl!(ReuniteError<()>: Send); + assert_not_impl!(ReuniteError<*const ()>: Send); + assert_impl!(ReuniteError<()>: Sync); + assert_not_impl!(ReuniteError<*const ()>: Sync); + assert_impl!(ReuniteError: Unpin); + + assert_impl!(Seek<'_, ()>: Send); + assert_not_impl!(Seek<'_, *const ()>: Send); + assert_impl!(Seek<'_, ()>: Sync); + assert_not_impl!(Seek<'_, *const ()>: Sync); + assert_impl!(Seek<'_, ()>: Unpin); + assert_not_impl!(Seek<'_, PhantomPinned>: Unpin); + + assert_impl!(Sink: Send); + assert_impl!(Sink: Sync); + assert_impl!(Sink: Unpin); + + assert_impl!(Take<()>: Send); + assert_not_impl!(Take<*const ()>: Send); + assert_impl!(Take<()>: Sync); + assert_not_impl!(Take<*const ()>: Sync); + assert_impl!(Take<()>: Unpin); + assert_not_impl!(Take: Unpin); + + assert_impl!(Window<()>: Send); + assert_not_impl!(Window<*const ()>: Send); + assert_impl!(Window<()>: Sync); + assert_not_impl!(Window<*const ()>: Sync); + assert_impl!(Window<()>: Unpin); + assert_not_impl!(Window: Unpin); + + assert_impl!(Write<'_, ()>: Send); + assert_not_impl!(Write<'_, *const ()>: Send); + assert_impl!(Write<'_, ()>: Sync); + assert_not_impl!(Write<'_, *const ()>: Sync); + assert_impl!(Write<'_, ()>: Unpin); + assert_not_impl!(Write<'_, PhantomPinned>: Unpin); + + assert_impl!(WriteAll<'_, ()>: Send); + assert_not_impl!(WriteAll<'_, *const ()>: Send); + assert_impl!(WriteAll<'_, ()>: Sync); + assert_not_impl!(WriteAll<'_, *const ()>: Sync); + assert_impl!(WriteAll<'_, ()>: Unpin); + assert_not_impl!(WriteAll<'_, PhantomPinned>: Unpin); + + #[cfg(feature = "write-all-vectored")] + assert_impl!(WriteAllVectored<'_, ()>: Send); + #[cfg(feature = "write-all-vectored")] + assert_not_impl!(WriteAllVectored<'_, *const ()>: Send); + #[cfg(feature = "write-all-vectored")] + assert_impl!(WriteAllVectored<'_, ()>: Sync); + #[cfg(feature = "write-all-vectored")] + assert_not_impl!(WriteAllVectored<'_, *const ()>: Sync); + #[cfg(feature = "write-all-vectored")] + assert_impl!(WriteAllVectored<'_, ()>: Unpin); + // WriteAllVectored requires `W: Unpin` + // #[cfg(feature = "write-all-vectored")] + // assert_not_impl!(WriteAllVectored<'_, PhantomPinned>: Unpin); + + assert_impl!(WriteHalf<()>: Send); + assert_not_impl!(WriteHalf<*const ()>: Send); + assert_impl!(WriteHalf<()>: Sync); + assert_not_impl!(WriteHalf<*const ()>: Sync); + assert_impl!(WriteHalf: Unpin); + + assert_impl!(WriteVectored<'_, ()>: Send); + assert_not_impl!(WriteVectored<'_, *const ()>: Send); + assert_impl!(WriteVectored<'_, ()>: Sync); + assert_not_impl!(WriteVectored<'_, *const ()>: Sync); + assert_impl!(WriteVectored<'_, ()>: Unpin); + assert_not_impl!(WriteVectored<'_, PhantomPinned>: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::lock`. +pub mod lock { + use super::*; + use futures::lock::*; + + #[cfg(feature = "bilock")] + assert_impl!(BiLock<()>: Send); + #[cfg(feature = "bilock")] + assert_not_impl!(BiLock<*const ()>: Send); + #[cfg(feature = "bilock")] + assert_impl!(BiLock<()>: Sync); + #[cfg(feature = "bilock")] + assert_not_impl!(BiLock<*const ()>: Sync); + #[cfg(feature = "bilock")] + assert_impl!(BiLock: Unpin); + + #[cfg(feature = "bilock")] + assert_impl!(BiLockAcquire<'_, ()>: Send); + #[cfg(feature = "bilock")] + assert_not_impl!(BiLockAcquire<'_, *const ()>: Send); + #[cfg(feature = "bilock")] + assert_impl!(BiLockAcquire<'_, ()>: Sync); + #[cfg(feature = "bilock")] + assert_not_impl!(BiLockAcquire<'_, *const ()>: Sync); + #[cfg(feature = "bilock")] + assert_impl!(BiLockAcquire<'_, PhantomPinned>: Unpin); + + #[cfg(feature = "bilock")] + assert_impl!(BiLockGuard<'_, ()>: Send); + #[cfg(feature = "bilock")] + assert_not_impl!(BiLockGuard<'_, *const ()>: Send); + #[cfg(feature = "bilock")] + assert_impl!(BiLockGuard<'_, ()>: Sync); + #[cfg(feature = "bilock")] + assert_not_impl!(BiLockGuard<'_, *const ()>: Sync); + #[cfg(feature = "bilock")] + assert_impl!(BiLockGuard<'_, PhantomPinned>: Unpin); + + assert_impl!(MappedMutexGuard<'_, (), ()>: Send); + assert_not_impl!(MappedMutexGuard<'_, (), *const ()>: Send); + assert_not_impl!(MappedMutexGuard<'_, *const (), ()>: Send); + assert_impl!(MappedMutexGuard<'_, (), ()>: Sync); + assert_not_impl!(MappedMutexGuard<'_, (), *const ()>: Sync); + assert_not_impl!(MappedMutexGuard<'_, *const (), ()>: Sync); + assert_impl!(MappedMutexGuard<'_, PhantomPinned, PhantomPinned>: Unpin); + + assert_impl!(Mutex<()>: Send); + assert_not_impl!(Mutex<*const ()>: Send); + assert_impl!(Mutex<()>: Sync); + assert_not_impl!(Mutex<*const ()>: Sync); + assert_impl!(Mutex<()>: Unpin); + assert_not_impl!(Mutex: Unpin); + + assert_impl!(MutexGuard<'_, ()>: Send); + assert_not_impl!(MutexGuard<'_, *const ()>: Send); + assert_impl!(MutexGuard<'_, ()>: Sync); + assert_not_impl!(MutexGuard<'_, *const ()>: Sync); + assert_impl!(MutexGuard<'_, PhantomPinned>: Unpin); + + assert_impl!(MutexLockFuture<'_, ()>: Send); + assert_not_impl!(MutexLockFuture<'_, *const ()>: Send); + assert_impl!(MutexLockFuture<'_, *const ()>: Sync); + assert_impl!(MutexLockFuture<'_, PhantomPinned>: Unpin); + + #[cfg(feature = "bilock")] + assert_impl!(ReuniteError<()>: Send); + #[cfg(feature = "bilock")] + assert_not_impl!(ReuniteError<*const ()>: Send); + #[cfg(feature = "bilock")] + assert_impl!(ReuniteError<()>: Sync); + #[cfg(feature = "bilock")] + assert_not_impl!(ReuniteError<*const ()>: Sync); + #[cfg(feature = "bilock")] + assert_impl!(ReuniteError: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::sink`. +pub mod sink { + use super::*; + use futures::sink::{self, *}; + use std::marker::Send; + + assert_impl!(Buffer<(), ()>: Send); + assert_not_impl!(Buffer<(), *const ()>: Send); + assert_not_impl!(Buffer<*const (), ()>: Send); + assert_impl!(Buffer<(), ()>: Sync); + assert_not_impl!(Buffer<(), *const ()>: Sync); + assert_not_impl!(Buffer<*const (), ()>: Sync); + assert_impl!(Buffer<(), PhantomPinned>: Unpin); + assert_not_impl!(Buffer: Unpin); + + assert_impl!(Close<'_, (), *const ()>: Send); + assert_not_impl!(Close<'_, *const (), ()>: Send); + assert_impl!(Close<'_, (), *const ()>: Sync); + assert_not_impl!(Close<'_, *const (), ()>: Sync); + assert_impl!(Close<'_, (), PhantomPinned>: Unpin); + assert_not_impl!(Close<'_, PhantomPinned, ()>: Unpin); + + assert_impl!(Drain<()>: Send); + assert_not_impl!(Drain<*const ()>: Send); + assert_impl!(Drain<()>: Sync); + assert_not_impl!(Drain<*const ()>: Sync); + assert_impl!(Drain: Unpin); + + assert_impl!(Fanout<(), ()>: Send); + assert_not_impl!(Fanout<(), *const ()>: Send); + assert_not_impl!(Fanout<*const (), ()>: Send); + assert_impl!(Fanout<(), ()>: Sync); + assert_not_impl!(Fanout<(), *const ()>: Sync); + assert_not_impl!(Fanout<*const (), ()>: Sync); + assert_impl!(Fanout<(), ()>: Unpin); + assert_not_impl!(Fanout<(), PhantomPinned>: Unpin); + assert_not_impl!(Fanout: Unpin); + + assert_impl!(Feed<'_, (), ()>: Send); + assert_not_impl!(Feed<'_, (), *const ()>: Send); + assert_not_impl!(Feed<'_, *const (), ()>: Send); + assert_impl!(Feed<'_, (), ()>: Sync); + assert_not_impl!(Feed<'_, (), *const ()>: Sync); + assert_not_impl!(Feed<'_, *const (), ()>: Sync); + assert_impl!(Feed<'_, (), PhantomPinned>: Unpin); + assert_not_impl!(Feed<'_, PhantomPinned, ()>: Unpin); + + assert_impl!(Flush<'_, (), *const ()>: Send); + assert_not_impl!(Flush<'_, *const (), ()>: Send); + assert_impl!(Flush<'_, (), *const ()>: Sync); + assert_not_impl!(Flush<'_, *const (), ()>: Sync); + assert_impl!(Flush<'_, (), PhantomPinned>: Unpin); + assert_not_impl!(Flush<'_, PhantomPinned, ()>: Unpin); + + assert_impl!(sink::Send<'_, (), ()>: Send); + assert_not_impl!(sink::Send<'_, (), *const ()>: Send); + assert_not_impl!(sink::Send<'_, *const (), ()>: Send); + assert_impl!(sink::Send<'_, (), ()>: Sync); + assert_not_impl!(sink::Send<'_, (), *const ()>: Sync); + assert_not_impl!(sink::Send<'_, *const (), ()>: Sync); + assert_impl!(sink::Send<'_, (), PhantomPinned>: Unpin); + assert_not_impl!(sink::Send<'_, PhantomPinned, ()>: Unpin); + + assert_impl!(SendAll<'_, (), SendTryStream<()>>: Send); + assert_not_impl!(SendAll<'_, (), SendTryStream>: Send); + assert_not_impl!(SendAll<'_, (), LocalTryStream>: Send); + assert_not_impl!(SendAll<'_, *const (), SendTryStream<()>>: Send); + assert_impl!(SendAll<'_, (), SyncTryStream<()>>: Sync); + assert_not_impl!(SendAll<'_, (), SyncTryStream>: Sync); + assert_not_impl!(SendAll<'_, (), LocalTryStream>: Sync); + assert_not_impl!(SendAll<'_, *const (), SyncTryStream<()>>: Sync); + assert_impl!(SendAll<'_, (), UnpinTryStream>: Unpin); + assert_not_impl!(SendAll<'_, PhantomPinned, UnpinTryStream>: Unpin); + assert_not_impl!(SendAll<'_, (), PinnedTryStream>: Unpin); + + assert_impl!(SinkErrInto: Send); + assert_not_impl!(SinkErrInto, (), ()>: Send); + assert_impl!(SinkErrInto: Sync); + assert_not_impl!(SinkErrInto, (), ()>: Sync); + assert_impl!(SinkErrInto: Unpin); + assert_not_impl!(SinkErrInto, (), ()>: Unpin); + + assert_impl!(SinkMapErr: Send); + assert_not_impl!(SinkMapErr: Send); + assert_not_impl!(SinkMapErr, ()>: Send); + assert_impl!(SinkMapErr: Sync); + assert_not_impl!(SinkMapErr: Sync); + assert_not_impl!(SinkMapErr, ()>: Sync); + assert_impl!(SinkMapErr: Unpin); + assert_not_impl!(SinkMapErr, ()>: Unpin); + + assert_impl!(Unfold<(), (), ()>: Send); + assert_not_impl!(Unfold<*const (), (), ()>: Send); + assert_not_impl!(Unfold<(), *const (), ()>: Send); + assert_not_impl!(Unfold<(), (), *const ()>: Send); + assert_impl!(Unfold<(), (), ()>: Sync); + assert_not_impl!(Unfold<*const (), (), ()>: Sync); + assert_not_impl!(Unfold<(), *const (), ()>: Sync); + assert_not_impl!(Unfold<(), (), *const ()>: Sync); + assert_impl!(Unfold: Unpin); + assert_not_impl!(Unfold, (), PhantomPinned>: Unpin); + + assert_impl!(With<(), *const (), *const (), (), ()>: Send); + assert_not_impl!(With<*const (), (), (), (), ()>: Send); + assert_not_impl!(With<(), (), (), *const (), ()>: Send); + assert_not_impl!(With<(), (), (), (), *const ()>: Send); + assert_impl!(With<(), *const (), *const (), (), ()>: Sync); + assert_not_impl!(With<*const (), (), (), (), ()>: Sync); + assert_not_impl!(With<(), (), (), *const (), ()>: Sync); + assert_not_impl!(With<(), (), (), (), *const ()>: Sync); + assert_impl!(With<(), PhantomPinned, PhantomPinned, (), PhantomPinned>: Unpin); + assert_not_impl!(With: Unpin); + assert_not_impl!(With<(), (), (), PhantomPinned, ()>: Unpin); + + assert_impl!(WithFlatMap<(), (), *const (), (), ()>: Send); + assert_not_impl!(WithFlatMap<*const (), (), (), (), ()>: Send); + assert_not_impl!(WithFlatMap<(), *const (), (), (), ()>: Send); + assert_not_impl!(WithFlatMap<(), (), (), *const (), ()>: Send); + assert_not_impl!(WithFlatMap<(), (), (), (), *const ()>: Send); + assert_impl!(WithFlatMap<(), (), *const (), (), ()>: Sync); + assert_not_impl!(WithFlatMap<*const (), (), (), (), ()>: Sync); + assert_not_impl!(WithFlatMap<(), *const (), (), (), ()>: Sync); + assert_not_impl!(WithFlatMap<(), (), (), *const (), ()>: Sync); + assert_not_impl!(WithFlatMap<(), (), (), (), *const ()>: Sync); + assert_impl!(WithFlatMap<(), PhantomPinned, PhantomPinned, (), PhantomPinned>: Unpin); + assert_not_impl!(WithFlatMap: Unpin); + assert_not_impl!(WithFlatMap<(), (), (), PhantomPinned, ()>: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::stream`. +pub mod stream { + use super::*; + use futures::{io, stream::*}; + + assert_impl!(AndThen<(), (), ()>: Send); + assert_not_impl!(AndThen<*const (), (), ()>: Send); + assert_not_impl!(AndThen<(), *const (), ()>: Send); + assert_not_impl!(AndThen<(), (), *const ()>: Send); + assert_impl!(AndThen<(), (), ()>: Sync); + assert_not_impl!(AndThen<*const (), (), ()>: Sync); + assert_not_impl!(AndThen<(), *const (), ()>: Sync); + assert_not_impl!(AndThen<(), (), *const ()>: Sync); + assert_impl!(AndThen<(), (), PhantomPinned>: Unpin); + assert_not_impl!(AndThen: Unpin); + assert_not_impl!(AndThen<(), PhantomPinned, ()>: Unpin); + + assert_impl!(BufferUnordered>: Send); + assert_not_impl!(BufferUnordered: Send); + assert_not_impl!(BufferUnordered: Send); + assert_impl!(BufferUnordered>: Sync); + assert_not_impl!(BufferUnordered: Sync); + assert_not_impl!(BufferUnordered: Sync); + assert_impl!(BufferUnordered: Unpin); + assert_not_impl!(BufferUnordered: Unpin); + + assert_impl!(Buffered>>: Send); + assert_not_impl!(Buffered>: Send); + assert_not_impl!(Buffered>: Send); + assert_not_impl!(Buffered>>: Send); + assert_impl!(Buffered>>: Sync); + assert_not_impl!(Buffered>: Sync); + assert_not_impl!(Buffered>: Sync); + assert_not_impl!(Buffered>>: Sync); + assert_impl!(Buffered>: Unpin); + assert_not_impl!(Buffered>: Unpin); + + assert_impl!(CatchUnwind: Send); + assert_not_impl!(CatchUnwind: Send); + assert_impl!(CatchUnwind: Sync); + assert_not_impl!(CatchUnwind: Sync); + assert_impl!(CatchUnwind: Unpin); + assert_not_impl!(CatchUnwind: Unpin); + + assert_impl!(Chain<(), ()>: Send); + assert_not_impl!(Chain<(), *const ()>: Send); + assert_not_impl!(Chain<*const (), ()>: Send); + assert_impl!(Chain<(), ()>: Sync); + assert_not_impl!(Chain<(), *const ()>: Sync); + assert_not_impl!(Chain<*const (), ()>: Sync); + assert_impl!(Chain<(), ()>: Unpin); + assert_not_impl!(Chain<(), PhantomPinned>: Unpin); + assert_not_impl!(Chain: Unpin); + + assert_impl!(Chunks>: Send); + assert_not_impl!(Chunks: Send); + assert_not_impl!(Chunks: Send); + assert_impl!(Chunks>: Sync); + assert_not_impl!(Chunks: Sync); + assert_not_impl!(Chunks: Sync); + assert_impl!(Chunks: Unpin); + assert_not_impl!(Chunks: Unpin); + + assert_impl!(Collect<(), ()>: Send); + assert_not_impl!(Collect<*const (), ()>: Send); + assert_not_impl!(Collect<(), *const ()>: Send); + assert_impl!(Collect<(), ()>: Sync); + assert_not_impl!(Collect<*const (), ()>: Sync); + assert_not_impl!(Collect<(), *const ()>: Sync); + assert_impl!(Collect<(), PhantomPinned>: Unpin); + assert_not_impl!(Collect: Unpin); + + assert_impl!(Concat>: Send); + assert_not_impl!(Concat: Send); + assert_not_impl!(Concat: Send); + assert_impl!(Concat>: Sync); + assert_not_impl!(Concat: Sync); + assert_not_impl!(Concat: Sync); + assert_impl!(Concat: Unpin); + assert_not_impl!(Concat: Unpin); + + assert_impl!(Cycle<()>: Send); + assert_not_impl!(Cycle<*const ()>: Send); + assert_impl!(Cycle<()>: Sync); + assert_not_impl!(Cycle<*const ()>: Sync); + assert_impl!(Cycle<()>: Unpin); + assert_not_impl!(Cycle: Unpin); + + assert_impl!(Empty<()>: Send); + assert_not_impl!(Empty<*const ()>: Send); + assert_impl!(Empty<()>: Sync); + assert_not_impl!(Empty<*const ()>: Sync); + assert_impl!(Empty: Unpin); + + assert_impl!(Enumerate<()>: Send); + assert_not_impl!(Enumerate<*const ()>: Send); + assert_impl!(Enumerate<()>: Sync); + assert_not_impl!(Enumerate<*const ()>: Sync); + assert_impl!(Enumerate<()>: Unpin); + assert_not_impl!(Enumerate: Unpin); + + assert_impl!(ErrInto<(), *const ()>: Send); + assert_not_impl!(ErrInto<*const (), ()>: Send); + assert_impl!(ErrInto<(), *const ()>: Sync); + assert_not_impl!(ErrInto<*const (), ()>: Sync); + assert_impl!(ErrInto<(), PhantomPinned>: Unpin); + assert_not_impl!(ErrInto: Unpin); + + assert_impl!(Filter, (), ()>: Send); + assert_not_impl!(Filter, (), ()>: Send); + assert_not_impl!(Filter: Send); + assert_not_impl!(Filter, *const (), ()>: Send); + assert_not_impl!(Filter, (), *const ()>: Send); + assert_impl!(Filter, (), ()>: Sync); + assert_not_impl!(Filter, (), ()>: Sync); + assert_not_impl!(Filter: Sync); + assert_not_impl!(Filter, *const (), ()>: Sync); + assert_not_impl!(Filter, (), *const ()>: Sync); + assert_impl!(Filter: Unpin); + assert_not_impl!(Filter: Unpin); + assert_not_impl!(Filter: Unpin); + + assert_impl!(FilterMap<(), (), ()>: Send); + assert_not_impl!(FilterMap<*const (), (), ()>: Send); + assert_not_impl!(FilterMap<(), *const (), ()>: Send); + assert_not_impl!(FilterMap<(), (), *const ()>: Send); + assert_impl!(FilterMap<(), (), ()>: Sync); + assert_not_impl!(FilterMap<*const (), (), ()>: Sync); + assert_not_impl!(FilterMap<(), *const (), ()>: Sync); + assert_not_impl!(FilterMap<(), (), *const ()>: Sync); + assert_impl!(FilterMap<(), (), PhantomPinned>: Unpin); + assert_not_impl!(FilterMap: Unpin); + assert_not_impl!(FilterMap<(), PhantomPinned, ()>: Unpin); + + assert_impl!(FlatMap<(), (), ()>: Send); + assert_not_impl!(FlatMap<*const (), (), ()>: Send); + assert_not_impl!(FlatMap<(), *const (), ()>: Send); + assert_not_impl!(FlatMap<(), (), *const ()>: Send); + assert_impl!(FlatMap<(), (), ()>: Sync); + assert_not_impl!(FlatMap<*const (), (), ()>: Sync); + assert_not_impl!(FlatMap<(), *const (), ()>: Sync); + assert_not_impl!(FlatMap<(), (), *const ()>: Sync); + assert_impl!(FlatMap<(), (), PhantomPinned>: Unpin); + assert_not_impl!(FlatMap: Unpin); + assert_not_impl!(FlatMap<(), PhantomPinned, ()>: Unpin); + + assert_impl!(Flatten>: Send); + assert_not_impl!(Flatten: Send); + assert_not_impl!(Flatten: Send); + assert_impl!(Flatten>: Sync); + assert_not_impl!(Flatten>: Sync); + assert_not_impl!(Flatten>: Sync); + assert_impl!(Flatten>: Unpin); + assert_not_impl!(Flatten: Unpin); + assert_not_impl!(Flatten: Unpin); + + assert_impl!(Fold<(), (), (), ()>: Send); + assert_not_impl!(Fold<*const (), (), (), ()>: Send); + assert_not_impl!(Fold<(), *const (), (), ()>: Send); + assert_not_impl!(Fold<(), (), *const (), ()>: Send); + assert_not_impl!(Fold<(), (), (), *const ()>: Send); + assert_impl!(Fold<(), (), (), ()>: Sync); + assert_not_impl!(Fold<*const (), (), (), ()>: Sync); + assert_not_impl!(Fold<(), *const (), (), ()>: Sync); + assert_not_impl!(Fold<(), (), *const (), ()>: Sync); + assert_not_impl!(Fold<(), (), (), *const ()>: Sync); + assert_impl!(Fold<(), (), PhantomPinned, PhantomPinned>: Unpin); + assert_not_impl!(Fold: Unpin); + assert_not_impl!(Fold<(), PhantomPinned, (), ()>: Unpin); + + assert_impl!(ForEach<(), (), ()>: Send); + assert_not_impl!(ForEach<*const (), (), ()>: Send); + assert_not_impl!(ForEach<(), *const (), ()>: Send); + assert_not_impl!(ForEach<(), (), *const ()>: Send); + assert_impl!(ForEach<(), (), ()>: Sync); + assert_not_impl!(ForEach<*const (), (), ()>: Sync); + assert_not_impl!(ForEach<(), *const (), ()>: Sync); + assert_not_impl!(ForEach<(), (), *const ()>: Sync); + assert_impl!(ForEach<(), (), PhantomPinned>: Unpin); + assert_not_impl!(ForEach: Unpin); + assert_not_impl!(ForEach<(), PhantomPinned, ()>: Unpin); + + assert_impl!(ForEachConcurrent<(), (), ()>: Send); + assert_not_impl!(ForEachConcurrent<*const (), (), ()>: Send); + assert_not_impl!(ForEachConcurrent<(), *const (), ()>: Send); + assert_not_impl!(ForEachConcurrent<(), (), *const ()>: Send); + assert_impl!(ForEachConcurrent<(), (), ()>: Sync); + assert_not_impl!(ForEachConcurrent<*const (), (), ()>: Sync); + assert_not_impl!(ForEachConcurrent<(), *const (), ()>: Sync); + assert_not_impl!(ForEachConcurrent<(), (), *const ()>: Sync); + assert_impl!(ForEachConcurrent<(), PhantomPinned, PhantomPinned>: Unpin); + assert_not_impl!(ForEachConcurrent: Unpin); + + assert_impl!(Forward, ()>: Send); + assert_not_impl!(Forward: Send); + assert_not_impl!(Forward, *const ()>: Send); + assert_not_impl!(Forward: Send); + assert_impl!(Forward, ()>: Sync); + assert_not_impl!(Forward: Sync); + assert_not_impl!(Forward, *const ()>: Sync); + assert_not_impl!(Forward: Sync); + assert_impl!(Forward: Unpin); + assert_not_impl!(Forward: Unpin); + assert_not_impl!(Forward: Unpin); + + assert_impl!(Fuse<()>: Send); + assert_not_impl!(Fuse<*const ()>: Send); + assert_impl!(Fuse<()>: Sync); + assert_not_impl!(Fuse<*const ()>: Sync); + assert_impl!(Fuse<()>: Unpin); + assert_not_impl!(Fuse: Unpin); + + assert_impl!(FuturesOrdered>: Send); + assert_not_impl!(FuturesOrdered: Send); + assert_not_impl!(FuturesOrdered: Send); + assert_impl!(FuturesOrdered>: Sync); + assert_not_impl!(FuturesOrdered>: Sync); + assert_not_impl!(FuturesOrdered>: Sync); + assert_impl!(FuturesOrdered: Unpin); + + assert_impl!(FuturesUnordered<()>: Send); + assert_not_impl!(FuturesUnordered<*const ()>: Send); + assert_impl!(FuturesUnordered<()>: Sync); + assert_not_impl!(FuturesUnordered<*const ()>: Sync); + assert_impl!(FuturesUnordered: Unpin); + + assert_impl!(Inspect<(), ()>: Send); + assert_not_impl!(Inspect<*const (), ()>: Send); + assert_not_impl!(Inspect<(), *const ()>: Send); + assert_impl!(Inspect<(), ()>: Sync); + assert_not_impl!(Inspect<*const (), ()>: Sync); + assert_not_impl!(Inspect<(), *const ()>: Sync); + assert_impl!(Inspect<(), PhantomPinned>: Unpin); + assert_not_impl!(Inspect: Unpin); + + assert_impl!(InspectErr<(), ()>: Send); + assert_not_impl!(InspectErr<*const (), ()>: Send); + assert_not_impl!(InspectErr<(), *const ()>: Send); + assert_impl!(InspectErr<(), ()>: Sync); + assert_not_impl!(InspectErr<*const (), ()>: Sync); + assert_not_impl!(InspectErr<(), *const ()>: Sync); + assert_impl!(InspectErr<(), PhantomPinned>: Unpin); + assert_not_impl!(InspectErr: Unpin); + + assert_impl!(InspectOk<(), ()>: Send); + assert_not_impl!(InspectOk<*const (), ()>: Send); + assert_not_impl!(InspectOk<(), *const ()>: Send); + assert_impl!(InspectOk<(), ()>: Sync); + assert_not_impl!(InspectOk<*const (), ()>: Sync); + assert_not_impl!(InspectOk<(), *const ()>: Sync); + assert_impl!(InspectOk<(), PhantomPinned>: Unpin); + assert_not_impl!(InspectOk: Unpin); + + assert_impl!(IntoAsyncRead, io::Error>>: Send); + assert_not_impl!(IntoAsyncRead, io::Error>>: Send); + assert_impl!(IntoAsyncRead, io::Error>>: Sync); + assert_not_impl!(IntoAsyncRead, io::Error>>: Sync); + assert_impl!(IntoAsyncRead, io::Error>>: Unpin); + // IntoAsyncRead requires `St: Unpin` + // assert_not_impl!(IntoAsyncRead, io::Error>>: Unpin); + + assert_impl!(IntoStream<()>: Send); + assert_not_impl!(IntoStream<*const ()>: Send); + assert_impl!(IntoStream<()>: Sync); + assert_not_impl!(IntoStream<*const ()>: Sync); + assert_impl!(IntoStream<()>: Unpin); + assert_not_impl!(IntoStream: Unpin); + + assert_impl!(Iter<()>: Send); + assert_not_impl!(Iter<*const ()>: Send); + assert_impl!(Iter<()>: Sync); + assert_not_impl!(Iter<*const ()>: Sync); + assert_impl!(Iter: Unpin); + + assert_impl!(Map<(), ()>: Send); + assert_not_impl!(Map<*const (), ()>: Send); + assert_not_impl!(Map<(), *const ()>: Send); + assert_impl!(Map<(), ()>: Sync); + assert_not_impl!(Map<*const (), ()>: Sync); + assert_not_impl!(Map<(), *const ()>: Sync); + assert_impl!(Map<(), PhantomPinned>: Unpin); + assert_not_impl!(Map: Unpin); + + assert_impl!(MapErr<(), ()>: Send); + assert_not_impl!(MapErr<*const (), ()>: Send); + assert_not_impl!(MapErr<(), *const ()>: Send); + assert_impl!(MapErr<(), ()>: Sync); + assert_not_impl!(MapErr<*const (), ()>: Sync); + assert_not_impl!(MapErr<(), *const ()>: Sync); + assert_impl!(MapErr<(), PhantomPinned>: Unpin); + assert_not_impl!(MapErr: Unpin); + + assert_impl!(MapOk<(), ()>: Send); + assert_not_impl!(MapOk<*const (), ()>: Send); + assert_not_impl!(MapOk<(), *const ()>: Send); + assert_impl!(MapOk<(), ()>: Sync); + assert_not_impl!(MapOk<*const (), ()>: Sync); + assert_not_impl!(MapOk<(), *const ()>: Sync); + assert_impl!(MapOk<(), PhantomPinned>: Unpin); + assert_not_impl!(MapOk: Unpin); + + assert_impl!(Next<'_, ()>: Send); + assert_not_impl!(Next<'_, *const ()>: Send); + assert_impl!(Next<'_, ()>: Sync); + assert_not_impl!(Next<'_, *const ()>: Sync); + assert_impl!(Next<'_, ()>: Unpin); + assert_not_impl!(Next<'_, PhantomPinned>: Unpin); + + assert_impl!(Once<()>: Send); + assert_not_impl!(Once<*const ()>: Send); + assert_impl!(Once<()>: Sync); + assert_not_impl!(Once<*const ()>: Sync); + assert_impl!(Once<()>: Unpin); + assert_not_impl!(Once: Unpin); + + assert_impl!(OrElse<(), (), ()>: Send); + assert_not_impl!(OrElse<*const (), (), ()>: Send); + assert_not_impl!(OrElse<(), *const (), ()>: Send); + assert_not_impl!(OrElse<(), (), *const ()>: Send); + assert_impl!(OrElse<(), (), ()>: Sync); + assert_not_impl!(OrElse<*const (), (), ()>: Sync); + assert_not_impl!(OrElse<(), *const (), ()>: Sync); + assert_not_impl!(OrElse<(), (), *const ()>: Sync); + assert_impl!(OrElse<(), (), PhantomPinned>: Unpin); + assert_not_impl!(OrElse: Unpin); + assert_not_impl!(OrElse<(), PhantomPinned, ()>: Unpin); + + assert_impl!(Peek<'_, SendStream<()>>: Send); + assert_not_impl!(Peek<'_, SendStream>: Send); + assert_not_impl!(Peek<'_, LocalStream<()>>: Send); + assert_impl!(Peek<'_, SyncStream<()>>: Sync); + assert_not_impl!(Peek<'_, SyncStream>: Sync); + assert_not_impl!(Peek<'_, LocalStream<()>>: Sync); + assert_impl!(Peek<'_, PinnedStream>: Unpin); + + assert_impl!(Peekable>: Send); + assert_not_impl!(Peekable: Send); + assert_not_impl!(Peekable: Send); + assert_impl!(Peekable>: Sync); + assert_not_impl!(Peekable: Sync); + assert_not_impl!(Peekable: Sync); + assert_impl!(Peekable: Unpin); + assert_not_impl!(Peekable: Unpin); + + assert_impl!(Pending<()>: Send); + assert_not_impl!(Pending<*const ()>: Send); + assert_impl!(Pending<()>: Sync); + assert_not_impl!(Pending<*const ()>: Sync); + assert_impl!(Pending: Unpin); + + assert_impl!(PollFn<()>: Send); + assert_not_impl!(PollFn<*const ()>: Send); + assert_impl!(PollFn<()>: Sync); + assert_not_impl!(PollFn<*const ()>: Sync); + assert_impl!(PollFn: Unpin); + + assert_impl!(ReadyChunks>: Send); + assert_not_impl!(ReadyChunks: Send); + assert_not_impl!(ReadyChunks: Send); + assert_impl!(ReadyChunks>: Sync); + assert_not_impl!(ReadyChunks: Sync); + assert_not_impl!(ReadyChunks: Sync); + assert_impl!(ReadyChunks: Unpin); + assert_not_impl!(ReadyChunks: Unpin); + + assert_impl!(Repeat<()>: Send); + assert_not_impl!(Repeat<*const ()>: Send); + assert_impl!(Repeat<()>: Sync); + assert_not_impl!(Repeat<*const ()>: Sync); + assert_impl!(Repeat: Unpin); + + assert_impl!(RepeatWith<()>: Send); + assert_not_impl!(RepeatWith<*const ()>: Send); + assert_impl!(RepeatWith<()>: Sync); + assert_not_impl!(RepeatWith<*const ()>: Sync); + // RepeatWith requires `F: FnMut() -> A` + assert_impl!(RepeatWith ()>: Unpin); + // assert_impl!(RepeatWith: Unpin); + + assert_impl!(ReuniteError<(), ()>: Send); + assert_not_impl!(ReuniteError<*const (), ()>: Send); + assert_not_impl!(ReuniteError<(), *const ()>: Send); + assert_impl!(ReuniteError<(), ()>: Sync); + assert_not_impl!(ReuniteError<*const (), ()>: Sync); + assert_not_impl!(ReuniteError<(), *const ()>: Sync); + assert_impl!(ReuniteError: Unpin); + + assert_impl!(Scan: Send); + assert_not_impl!(Scan, (), (), ()>: Send); + assert_not_impl!(Scan, *const (), (), ()>: Send); + assert_not_impl!(Scan, (), *const (), ()>: Send); + assert_not_impl!(Scan, (), (), *const ()>: Send); + assert_impl!(Scan: Sync); + assert_not_impl!(Scan, (), (), ()>: Sync); + assert_not_impl!(Scan, *const (), (), ()>: Sync); + assert_not_impl!(Scan, (), *const (), ()>: Sync); + assert_not_impl!(Scan, (), (), *const ()>: Sync); + assert_impl!(Scan: Unpin); + assert_not_impl!(Scan: Unpin); + assert_not_impl!(Scan: Unpin); + + assert_impl!(Select<(), ()>: Send); + assert_not_impl!(Select<*const (), ()>: Send); + assert_not_impl!(Select<(), *const ()>: Send); + assert_impl!(Select<(), ()>: Sync); + assert_not_impl!(Select<*const (), ()>: Sync); + assert_not_impl!(Select<(), *const ()>: Sync); + assert_impl!(Select<(), ()>: Unpin); + assert_not_impl!(Select: Unpin); + assert_not_impl!(Select<(), PhantomPinned>: Unpin); + + assert_impl!(SelectAll<()>: Send); + assert_not_impl!(SelectAll<*const ()>: Send); + assert_impl!(SelectAll<()>: Sync); + assert_not_impl!(SelectAll<*const ()>: Sync); + assert_impl!(SelectAll: Unpin); + + assert_impl!(SelectNextSome<'_, ()>: Send); + assert_not_impl!(SelectNextSome<'_, *const ()>: Send); + assert_impl!(SelectNextSome<'_, ()>: Sync); + assert_not_impl!(SelectNextSome<'_, *const ()>: Sync); + assert_impl!(SelectNextSome<'_, PhantomPinned>: Unpin); + + assert_impl!(Skip<()>: Send); + assert_not_impl!(Skip<*const ()>: Send); + assert_impl!(Skip<()>: Sync); + assert_not_impl!(Skip<*const ()>: Sync); + assert_impl!(Skip<()>: Unpin); + assert_not_impl!(Skip: Unpin); + + assert_impl!(SkipWhile, (), ()>: Send); + assert_not_impl!(SkipWhile, (), ()>: Send); + assert_not_impl!(SkipWhile: Send); + assert_not_impl!(SkipWhile, *const (), ()>: Send); + assert_not_impl!(SkipWhile, (), *const ()>: Send); + assert_impl!(SkipWhile, (), ()>: Sync); + assert_not_impl!(SkipWhile, (), ()>: Sync); + assert_not_impl!(SkipWhile: Sync); + assert_not_impl!(SkipWhile, *const (), ()>: Sync); + assert_not_impl!(SkipWhile, (), *const ()>: Sync); + assert_impl!(SkipWhile: Unpin); + assert_not_impl!(SkipWhile: Unpin); + assert_not_impl!(SkipWhile: Unpin); + + assert_impl!(SplitSink<(), ()>: Send); + assert_not_impl!(SplitSink<*const (), ()>: Send); + assert_not_impl!(SplitSink<(), *const ()>: Send); + assert_impl!(SplitSink<(), ()>: Sync); + assert_not_impl!(SplitSink<*const (), ()>: Sync); + assert_not_impl!(SplitSink<(), *const ()>: Sync); + assert_impl!(SplitSink: Unpin); + + assert_impl!(SplitStream<()>: Send); + assert_not_impl!(SplitStream<*const ()>: Send); + assert_impl!(SplitStream<()>: Sync); + assert_not_impl!(SplitStream<*const ()>: Sync); + assert_impl!(SplitStream: Unpin); + + assert_impl!(StreamFuture<()>: Send); + assert_not_impl!(StreamFuture<*const ()>: Send); + assert_impl!(StreamFuture<()>: Sync); + assert_not_impl!(StreamFuture<*const ()>: Sync); + assert_impl!(StreamFuture<()>: Unpin); + assert_not_impl!(StreamFuture: Unpin); + + assert_impl!(Take<()>: Send); + assert_not_impl!(Take<*const ()>: Send); + assert_impl!(Take<()>: Sync); + assert_not_impl!(Take<*const ()>: Sync); + assert_impl!(Take<()>: Unpin); + assert_not_impl!(Take: Unpin); + + assert_impl!(TakeUntil>: Send); + assert_not_impl!(TakeUntil: Send); + assert_not_impl!(TakeUntil>: Send); + assert_not_impl!(TakeUntil>: Send); + assert_impl!(TakeUntil>: Sync); + assert_not_impl!(TakeUntil: Sync); + assert_not_impl!(TakeUntil>: Sync); + assert_not_impl!(TakeUntil>: Sync); + assert_impl!(TakeUntil: Unpin); + assert_not_impl!(TakeUntil: Unpin); + assert_not_impl!(TakeUntil: Unpin); + + assert_impl!(TakeWhile, (), ()>: Send); + assert_not_impl!(TakeWhile, (), ()>: Send); + assert_not_impl!(TakeWhile: Send); + assert_not_impl!(TakeWhile, *const (), ()>: Send); + assert_not_impl!(TakeWhile, (), *const ()>: Send); + assert_impl!(TakeWhile, (), ()>: Sync); + assert_not_impl!(TakeWhile, (), ()>: Sync); + assert_not_impl!(TakeWhile: Sync); + assert_not_impl!(TakeWhile, *const (), ()>: Sync); + assert_not_impl!(TakeWhile, (), *const ()>: Sync); + assert_impl!(TakeWhile: Unpin); + assert_not_impl!(TakeWhile: Unpin); + assert_not_impl!(TakeWhile: Unpin); + + assert_impl!(Then: Send); + assert_not_impl!(Then, (), ()>: Send); + assert_not_impl!(Then, *const (), ()>: Send); + assert_not_impl!(Then, (), *const ()>: Send); + assert_impl!(Then: Sync); + assert_not_impl!(Then, (), ()>: Sync); + assert_not_impl!(Then, *const (), ()>: Sync); + assert_not_impl!(Then, (), *const ()>: Sync); + assert_impl!(Then: Unpin); + assert_not_impl!(Then: Unpin); + assert_not_impl!(Then: Unpin); + + assert_impl!(TryBufferUnordered>: Send); + assert_not_impl!(TryBufferUnordered: Send); + assert_not_impl!(TryBufferUnordered: Send); + assert_impl!(TryBufferUnordered>: Sync); + assert_not_impl!(TryBufferUnordered: Sync); + assert_not_impl!(TryBufferUnordered: Sync); + assert_impl!(TryBufferUnordered: Unpin); + assert_not_impl!(TryBufferUnordered: Unpin); + + assert_impl!(TryBuffered>>: Send); + assert_not_impl!(TryBuffered>>: Send); + assert_not_impl!(TryBuffered>>: Send); + assert_not_impl!(TryBuffered>>: Send); + assert_not_impl!(TryBuffered>>: Send); + assert_impl!(TryBuffered>>: Sync); + assert_not_impl!(TryBuffered>>: Sync); + assert_not_impl!(TryBuffered>>: Sync); + assert_not_impl!(TryBuffered>>: Sync); + assert_not_impl!(TryBuffered>>: Sync); + assert_impl!(TryBuffered>: Unpin); + assert_not_impl!(TryBuffered>: Unpin); + + assert_impl!(TryCollect<(), ()>: Send); + assert_not_impl!(TryCollect<*const (), ()>: Send); + assert_not_impl!(TryCollect<(), *const ()>: Send); + assert_impl!(TryCollect<(), ()>: Sync); + assert_not_impl!(TryCollect<*const (), ()>: Sync); + assert_not_impl!(TryCollect<(), *const ()>: Sync); + assert_impl!(TryCollect<(), PhantomPinned>: Unpin); + assert_not_impl!(TryCollect: Unpin); + + assert_impl!(TryConcat>: Send); + assert_not_impl!(TryConcat: Send); + assert_not_impl!(TryConcat: Send); + assert_impl!(TryConcat>: Sync); + assert_not_impl!(TryConcat: Sync); + assert_not_impl!(TryConcat: Sync); + assert_impl!(TryConcat: Unpin); + assert_not_impl!(TryConcat: Unpin); + + assert_impl!(TryFilter, (), ()>: Send); + assert_not_impl!(TryFilter, (), ()>: Send); + assert_not_impl!(TryFilter: Send); + assert_not_impl!(TryFilter, *const (), ()>: Send); + assert_not_impl!(TryFilter, (), *const ()>: Send); + assert_impl!(TryFilter, (), ()>: Sync); + assert_not_impl!(TryFilter, (), ()>: Sync); + assert_not_impl!(TryFilter: Sync); + assert_not_impl!(TryFilter, *const (), ()>: Sync); + assert_not_impl!(TryFilter, (), *const ()>: Sync); + assert_impl!(TryFilter: Unpin); + assert_not_impl!(TryFilter: Unpin); + assert_not_impl!(TryFilter: Unpin); + + assert_impl!(TryFilterMap<(), (), ()>: Send); + assert_not_impl!(TryFilterMap<*const (), (), ()>: Send); + assert_not_impl!(TryFilterMap<(), *const (), ()>: Send); + assert_not_impl!(TryFilterMap<(), (), *const ()>: Send); + assert_impl!(TryFilterMap<(), (), ()>: Sync); + assert_not_impl!(TryFilterMap<*const (), (), ()>: Sync); + assert_not_impl!(TryFilterMap<(), *const (), ()>: Sync); + assert_not_impl!(TryFilterMap<(), (), *const ()>: Sync); + assert_impl!(TryFilterMap<(), (), PhantomPinned>: Unpin); + assert_not_impl!(TryFilterMap: Unpin); + assert_not_impl!(TryFilterMap<(), PhantomPinned, ()>: Unpin); + + assert_impl!(TryFlatten>: Send); + assert_not_impl!(TryFlatten: Send); + assert_not_impl!(TryFlatten: Send); + assert_impl!(TryFlatten>: Sync); + assert_not_impl!(TryFlatten>: Sync); + assert_not_impl!(TryFlatten>: Sync); + assert_impl!(TryFlatten>: Unpin); + assert_not_impl!(TryFlatten: Unpin); + assert_not_impl!(TryFlatten: Unpin); + + assert_impl!(TryFold<(), (), (), ()>: Send); + assert_not_impl!(TryFold<*const (), (), (), ()>: Send); + assert_not_impl!(TryFold<(), *const (), (), ()>: Send); + assert_not_impl!(TryFold<(), (), *const (), ()>: Send); + assert_not_impl!(TryFold<(), (), (), *const ()>: Send); + assert_impl!(TryFold<(), (), (), ()>: Sync); + assert_not_impl!(TryFold<*const (), (), (), ()>: Sync); + assert_not_impl!(TryFold<(), *const (), (), ()>: Sync); + assert_not_impl!(TryFold<(), (), *const (), ()>: Sync); + assert_not_impl!(TryFold<(), (), (), *const ()>: Sync); + assert_impl!(TryFold<(), (), PhantomPinned, PhantomPinned>: Unpin); + assert_not_impl!(TryFold: Unpin); + assert_not_impl!(TryFold<(), PhantomPinned, (), ()>: Unpin); + + assert_impl!(TryForEach<(), (), ()>: Send); + assert_not_impl!(TryForEach<*const (), (), ()>: Send); + assert_not_impl!(TryForEach<(), *const (), ()>: Send); + assert_not_impl!(TryForEach<(), (), *const ()>: Send); + assert_impl!(TryForEach<(), (), ()>: Sync); + assert_not_impl!(TryForEach<*const (), (), ()>: Sync); + assert_not_impl!(TryForEach<(), *const (), ()>: Sync); + assert_not_impl!(TryForEach<(), (), *const ()>: Sync); + assert_impl!(TryForEach<(), (), PhantomPinned>: Unpin); + assert_not_impl!(TryForEach: Unpin); + assert_not_impl!(TryForEach<(), PhantomPinned, ()>: Unpin); + + assert_impl!(TryForEachConcurrent<(), (), ()>: Send); + assert_not_impl!(TryForEachConcurrent<*const (), (), ()>: Send); + assert_not_impl!(TryForEachConcurrent<(), *const (), ()>: Send); + assert_not_impl!(TryForEachConcurrent<(), (), *const ()>: Send); + assert_impl!(TryForEachConcurrent<(), (), ()>: Sync); + assert_not_impl!(TryForEachConcurrent<*const (), (), ()>: Sync); + assert_not_impl!(TryForEachConcurrent<(), *const (), ()>: Sync); + assert_not_impl!(TryForEachConcurrent<(), (), *const ()>: Sync); + assert_impl!(TryForEachConcurrent<(), PhantomPinned, PhantomPinned>: Unpin); + assert_not_impl!(TryForEachConcurrent: Unpin); + + assert_impl!(TryNext<'_, ()>: Send); + assert_not_impl!(TryNext<'_, *const ()>: Send); + assert_impl!(TryNext<'_, ()>: Sync); + assert_not_impl!(TryNext<'_, *const ()>: Sync); + assert_impl!(TryNext<'_, ()>: Unpin); + assert_not_impl!(TryNext<'_, PhantomPinned>: Unpin); + + assert_impl!(TrySkipWhile, (), ()>: Send); + assert_not_impl!(TrySkipWhile, (), ()>: Send); + assert_not_impl!(TrySkipWhile: Send); + assert_not_impl!(TrySkipWhile, *const (), ()>: Send); + assert_not_impl!(TrySkipWhile, (), *const ()>: Send); + assert_impl!(TrySkipWhile, (), ()>: Sync); + assert_not_impl!(TrySkipWhile, (), ()>: Sync); + assert_not_impl!(TrySkipWhile: Sync); + assert_not_impl!(TrySkipWhile, *const (), ()>: Sync); + assert_not_impl!(TrySkipWhile, (), *const ()>: Sync); + assert_impl!(TrySkipWhile: Unpin); + assert_not_impl!(TrySkipWhile: Unpin); + assert_not_impl!(TrySkipWhile: Unpin); + + assert_impl!(TryTakeWhile, (), ()>: Send); + assert_not_impl!(TryTakeWhile, (), ()>: Send); + assert_not_impl!(TryTakeWhile: Send); + assert_not_impl!(TryTakeWhile, *const (), ()>: Send); + assert_not_impl!(TryTakeWhile, (), *const ()>: Send); + assert_impl!(TryTakeWhile, (), ()>: Sync); + assert_not_impl!(TryTakeWhile, (), ()>: Sync); + assert_not_impl!(TryTakeWhile: Sync); + assert_not_impl!(TryTakeWhile, *const (), ()>: Sync); + assert_not_impl!(TryTakeWhile, (), *const ()>: Sync); + assert_impl!(TryTakeWhile: Unpin); + assert_not_impl!(TryTakeWhile: Unpin); + assert_not_impl!(TryTakeWhile: Unpin); + + assert_impl!(TryUnfold<(), (), ()>: Send); + assert_not_impl!(TryUnfold<*const (), (), ()>: Send); + assert_not_impl!(TryUnfold<(), *const (), ()>: Send); + assert_not_impl!(TryUnfold<(), (), *const ()>: Send); + assert_impl!(TryUnfold<(), (), ()>: Sync); + assert_not_impl!(TryUnfold<*const (), (), ()>: Sync); + assert_not_impl!(TryUnfold<(), *const (), ()>: Sync); + assert_not_impl!(TryUnfold<(), (), *const ()>: Sync); + assert_impl!(TryUnfold: Unpin); + assert_not_impl!(TryUnfold<(), (), PhantomPinned>: Unpin); + + assert_impl!(Unfold<(), (), ()>: Send); + assert_not_impl!(Unfold<*const (), (), ()>: Send); + assert_not_impl!(Unfold<(), *const (), ()>: Send); + assert_not_impl!(Unfold<(), (), *const ()>: Send); + assert_impl!(Unfold<(), (), ()>: Sync); + assert_not_impl!(Unfold<*const (), (), ()>: Sync); + assert_not_impl!(Unfold<(), *const (), ()>: Sync); + assert_not_impl!(Unfold<(), (), *const ()>: Sync); + assert_impl!(Unfold: Unpin); + assert_not_impl!(Unfold<(), (), PhantomPinned>: Unpin); + + assert_impl!(Unzip<(), (), ()>: Send); + assert_not_impl!(Unzip<*const (), (), ()>: Send); + assert_not_impl!(Unzip<(), *const (), ()>: Send); + assert_not_impl!(Unzip<(), (), *const ()>: Send); + assert_impl!(Unzip<(), (), ()>: Sync); + assert_not_impl!(Unzip<*const (), (), ()>: Sync); + assert_not_impl!(Unzip<(), *const (), ()>: Sync); + assert_not_impl!(Unzip<(), (), *const ()>: Sync); + assert_impl!(Unzip<(), PhantomPinned, PhantomPinned>: Unpin); + assert_not_impl!(Unzip: Unpin); + + assert_impl!(Zip, SendStream<()>>: Send); + assert_not_impl!(Zip>: Send); + assert_not_impl!(Zip, SendStream>: Send); + assert_not_impl!(Zip>: Send); + assert_not_impl!(Zip, LocalStream>: Send); + assert_impl!(Zip, SyncStream<()>>: Sync); + assert_not_impl!(Zip>: Sync); + assert_not_impl!(Zip, SyncStream>: Sync); + assert_not_impl!(Zip>: Sync); + assert_not_impl!(Zip, LocalStream>: Sync); + assert_impl!(Zip: Unpin); + assert_not_impl!(Zip: Unpin); + assert_not_impl!(Zip: Unpin); + + assert_not_impl!(futures_unordered::Iter<()>: Send); + assert_not_impl!(futures_unordered::Iter<()>: Sync); + assert_impl!(futures_unordered::Iter<()>: Unpin); + // futures_unordered::Iter requires `Fut: Unpin` + // assert_not_impl!(futures_unordered::Iter: Unpin); + + assert_not_impl!(futures_unordered::IterMut<()>: Send); + assert_not_impl!(futures_unordered::IterMut<()>: Sync); + assert_impl!(futures_unordered::IterMut<()>: Unpin); + // futures_unordered::IterMut requires `Fut: Unpin` + // assert_not_impl!(futures_unordered::IterMut: Unpin); + + assert_not_impl!(futures_unordered::IterPinMut<()>: Send); + assert_not_impl!(futures_unordered::IterPinMut<()>: Sync); + assert_impl!(futures_unordered::IterPinMut: Unpin); + + assert_not_impl!(futures_unordered::IterPinRef<()>: Send); + assert_not_impl!(futures_unordered::IterPinRef<()>: Sync); + assert_impl!(futures_unordered::IterPinRef: Unpin); +} + +/// Assert Send/Sync/Unpin for all public types in `futures::task`. +pub mod task { + use super::*; + use futures::task::*; + + assert_impl!(AtomicWaker: Send); + assert_impl!(AtomicWaker: Sync); + assert_impl!(AtomicWaker: Unpin); + + assert_impl!(FutureObj<*const ()>: Send); + assert_not_impl!(FutureObj<()>: Sync); + assert_impl!(FutureObj: Unpin); + + assert_not_impl!(LocalFutureObj<()>: Send); + assert_not_impl!(LocalFutureObj<()>: Sync); + assert_impl!(LocalFutureObj: Unpin); + + assert_impl!(SpawnError: Send); + assert_impl!(SpawnError: Sync); + assert_impl!(SpawnError: Unpin); + + assert_impl!(WakerRef<'_>: Send); + assert_impl!(WakerRef<'_>: Sync); + assert_impl!(WakerRef<'_>: Unpin); +}