diff --git a/src/io/buf_read/mod.rs b/src/io/buf_read/mod.rs index 7a0ecc60..3ee6e30b 100644 --- a/src/io/buf_read/mod.rs +++ b/src/io/buf_read/mod.rs @@ -124,7 +124,7 @@ extension_trait! { &'a mut self, byte: u8, buf: &'a mut Vec, - ) -> impl Future + 'a [ReadUntilFuture<'a, Self>] + ) -> impl Future [ReadUntilFuture<'a, Self>] where Self: Unpin, { @@ -177,7 +177,7 @@ extension_trait! { fn read_line<'a>( &'a mut self, buf: &'a mut String, - ) -> impl Future> + 'a [ReadLineFuture<'a, Self>] + ) -> impl Future> [ReadLineFuture<'a, Self>] where Self: Unpin, { diff --git a/src/io/read/mod.rs b/src/io/read/mod.rs index 388237c8..c8f4e28b 100644 --- a/src/io/read/mod.rs +++ b/src/io/read/mod.rs @@ -112,7 +112,7 @@ extension_trait! { fn read<'a>( &'a mut self, buf: &'a mut [u8], - ) -> impl Future> + 'a [ReadFuture<'a, Self>] + ) -> impl Future> [ReadFuture<'a, Self>] where Self: Unpin { @@ -134,7 +134,7 @@ extension_trait! { fn read_vectored<'a>( &'a mut self, bufs: &'a mut [IoSliceMut<'a>], - ) -> impl Future> + 'a [ReadVectoredFuture<'a, Self>] + ) -> impl Future> [ReadVectoredFuture<'a, Self>] where Self: Unpin, { @@ -171,7 +171,7 @@ extension_trait! { fn read_to_end<'a>( &'a mut self, buf: &'a mut Vec, - ) -> impl Future> + 'a [ReadToEndFuture<'a, Self>] + ) -> impl Future> [ReadToEndFuture<'a, Self>] where Self: Unpin, { @@ -210,7 +210,7 @@ extension_trait! { fn read_to_string<'a>( &'a mut self, buf: &'a mut String, - ) -> impl Future> + 'a [ReadToStringFuture<'a, Self>] + ) -> impl Future> [ReadToStringFuture<'a, Self>] where Self: Unpin, { @@ -265,7 +265,7 @@ extension_trait! { fn read_exact<'a>( &'a mut self, buf: &'a mut [u8], - ) -> impl Future> + 'a [ReadExactFuture<'a, Self>] + ) -> impl Future> [ReadExactFuture<'a, Self>] where Self: Unpin, { diff --git a/src/io/seek/mod.rs b/src/io/seek/mod.rs index f565ca46..3b5036c8 100644 --- a/src/io/seek/mod.rs +++ b/src/io/seek/mod.rs @@ -76,7 +76,7 @@ extension_trait! { fn seek( &mut self, pos: SeekFrom, - ) -> impl Future> + '_ [SeekFuture<'_, Self>] + ) -> impl Future> [SeekFuture<'_, Self>] where Self: Unpin, { diff --git a/src/io/write/mod.rs b/src/io/write/mod.rs index 0ed91dda..3dee9feb 100644 --- a/src/io/write/mod.rs +++ b/src/io/write/mod.rs @@ -110,7 +110,7 @@ extension_trait! { fn write<'a>( &'a mut self, buf: &'a [u8], - ) -> impl Future> + 'a [WriteFuture<'a, Self>] + ) -> impl Future> [WriteFuture<'a, Self>] where Self: Unpin, { @@ -136,7 +136,7 @@ extension_trait! { # Ok(()) }) } ``` "#] - fn flush(&mut self) -> impl Future> + '_ [FlushFuture<'_, Self>] + fn flush(&mut self) -> impl Future> [FlushFuture<'_, Self>] where Self: Unpin, { @@ -158,7 +158,7 @@ extension_trait! { fn write_vectored<'a>( &'a mut self, bufs: &'a [IoSlice<'a>], - ) -> impl Future> + 'a [WriteVectoredFuture<'a, Self>] + ) -> impl Future> [WriteVectoredFuture<'a, Self>] where Self: Unpin, { @@ -194,7 +194,7 @@ extension_trait! { fn write_all<'a>( &'a mut self, buf: &'a [u8], - ) -> impl Future> + 'a [WriteAllFuture<'a, Self>] + ) -> impl Future> [WriteAllFuture<'a, Self>] where Self: Unpin, { @@ -231,7 +231,7 @@ extension_trait! { fn write_fmt<'a>( &'a mut self, fmt: std::fmt::Arguments<'_>, - ) -> impl Future> + 'a [WriteFmtFuture<'a, Self>] + ) -> impl Future> [WriteFmtFuture<'a, Self>] where Self: Unpin, { diff --git a/src/stream/stream/mod.rs b/src/stream/stream/mod.rs index 4e074a2f..af7407a2 100644 --- a/src/stream/stream/mod.rs +++ b/src/stream/stream/mod.rs @@ -260,7 +260,7 @@ extension_trait! { # }) } ``` "#] - fn next(&mut self) -> impl Future> + '_ [NextFuture<'_, Self>] + fn next(&mut self) -> impl Future> [NextFuture<'_, Self>] where Self: Unpin, { @@ -1165,7 +1165,7 @@ extension_trait! { fn nth( &mut self, n: usize, - ) -> impl Future> + '_ [NthFuture<'_, Self>] + ) -> impl Future> [NthFuture<'_, Self>] where Self: Unpin + Sized, { @@ -1221,7 +1221,7 @@ extension_trait! { fn all( &mut self, f: F, - ) -> impl Future + '_ [AllFuture<'_, Self, F, Self::Item>] + ) -> impl Future [AllFuture<'_, Self, F, Self::Item>] where Self: Unpin + Sized, F: FnMut(Self::Item) -> bool, @@ -1270,7 +1270,7 @@ extension_trait! { fn find

( &mut self, p: P, - ) -> impl Future> + '_ [FindFuture<'_, Self, P>] + ) -> impl Future> [FindFuture<'_, Self, P>] where Self: Unpin + Sized, P: FnMut(&Self::Item) -> bool, @@ -1298,7 +1298,7 @@ extension_trait! { fn find_map( &mut self, f: F, - ) -> impl Future> + '_ [FindMapFuture<'_, Self, F>] + ) -> impl Future> [FindMapFuture<'_, Self, F>] where Self: Unpin + Sized, F: FnMut(Self::Item) -> Option, @@ -1461,7 +1461,7 @@ extension_trait! { fn any( &mut self, f: F, - ) -> impl Future + '_ [AnyFuture<'_, Self, F, Self::Item>] + ) -> impl Future [AnyFuture<'_, Self, F, Self::Item>] where Self: Unpin + Sized, F: FnMut(Self::Item) -> bool, @@ -1697,7 +1697,7 @@ extension_trait! { &mut self, init: T, f: F, - ) -> impl Future> + '_ [TryFoldFuture<'_, Self, F, T>] + ) -> impl Future> [TryFoldFuture<'_, Self, F, T>] where Self: Unpin + Sized, F: FnMut(B, Self::Item) -> Result, @@ -1742,7 +1742,7 @@ extension_trait! { fn try_for_each( &mut self, f: F, - ) -> impl Future + 'a [TryForEachFuture<'_, Self, F>] + ) -> impl Future [TryForEachFuture<'_, Self, F>] where Self: Unpin + Sized, F: FnMut(Self::Item) -> Result<(), E>, @@ -1888,7 +1888,7 @@ extension_trait! { #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn collect<'a, B>( self, - ) -> impl Future + 'a [Pin + 'a + Send>>] + ) -> impl Future [Pin + 'a + Send>>] where Self: Sized + 'a + Send, B: FromStream, @@ -2002,7 +2002,7 @@ extension_trait! { fn position

( &mut self, predicate: P, - ) -> impl Future> + '_ [PositionFuture<'_, Self, P>] + ) -> impl Future> [PositionFuture<'_, Self, P>] where Self: Unpin + Sized, P: FnMut(Self::Item) -> bool, @@ -2335,7 +2335,7 @@ extension_trait! { #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn sum<'a, S>( self, - ) -> impl Future + 'a [Pin + 'a>>] + ) -> impl Future [Pin + 'a>>] where Self: Sized + Stream + 'a, S: Sum, @@ -2381,7 +2381,7 @@ extension_trait! { #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn product<'a, P>( self, - ) -> impl Future + 'a [Pin + 'a>>] + ) -> impl Future [Pin + 'a>>] where Self: Sized + Stream + 'a, P: Product, diff --git a/src/utils.rs b/src/utils.rs index 6ae49115..88731d28 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -302,10 +302,10 @@ macro_rules! extension_trait { }; // Parse the return type in an extension method. - (@doc [-> impl Future $(+ $lt:lifetime)? [$f:ty] $($tail:tt)*] -> [$($accum:tt)*]) => { + (@doc [-> impl Future [$f:ty] $($tail:tt)*] -> [$($accum:tt)*]) => { extension_trait!(@doc [$($tail)*] -> [$($accum)* -> owned::ImplFuture<$out>]); }; - (@ext [-> impl Future $(+ $lt:lifetime)? [$f:ty] $($tail:tt)*] -> [$($accum:tt)*]) => { + (@ext [-> impl Future [$f:ty] $($tail:tt)*] -> [$($accum:tt)*]) => { extension_trait!(@ext [$($tail)*] -> [$($accum)* -> $f]); };