extern crate futures03_crate as futures; use auto_enums::enum_derive; enum Enum { A(A), B(B), } impl ::futures::stream::Stream for Enum where A: ::futures::stream::Stream, B: ::futures::stream::Stream::Item>, { type Item = ::Item; #[inline] fn size_hint(&self) -> (usize, ::core::option::Option) { match self { Enum::A(x) => ::size_hint(x), Enum::B(x) => ::size_hint(x), } } #[inline] fn poll_next( self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>, ) -> ::core::task::Poll<::core::option::Option> { unsafe { match self.get_unchecked_mut() { Enum::A(x) => { ::poll_next( ::core::pin::Pin::new_unchecked(x), cx, ) } Enum::B(x) => { ::poll_next( ::core::pin::Pin::new_unchecked(x), cx, ) } } } } } impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, B: ::core::marker::Unpin, {} const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] impl MustNotImplDrop for T {} impl MustNotImplDrop for Enum {} }; fn main() {}