Skip to content

Commit 35d40d1

Browse files
committed
works
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent 7648ae6 commit 35d40d1

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/future/future/mod.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ extension_trait! {
166166
"#]
167167
#[cfg(any(feature = "unstable", feature = "docs"))]
168168
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
169-
fn select<F>(self, other: F) ->
170-
impl Future<Output = Self::Output> [Select<Self, F>]
169+
fn select<F>(
170+
self,
171+
other: F
172+
) -> impl Future<Output = <Self as std::future::Future>::Output> [Select<Self, F>]
171173
where
172-
Self: Sized + Future,
173-
F: std::future::Future<Output = <Self as Future>::Output>,
174+
Self: std::future::Future + Sized,
175+
F: std::future::Future<Output = <Self as std::future::Future>::Output>,
174176
{
175177
Select::new(self, other)
176178
}
@@ -205,12 +207,13 @@ extension_trait! {
205207
"#]
206208
#[cfg(any(feature = "unstable", feature = "docs"))]
207209
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
208-
fn try_select<F, T, E>(self, other: F) ->
209-
impl Future<Output = Self::Output> [TrySelect<Self, F>]
210+
fn try_select<F: std::future::Future, T, E>(
211+
self,
212+
other: F
213+
) -> impl Future<Output = <Self as std::future::Future>::Output> [TrySelect<Self, F>]
210214
where
211-
Self: Sized,
212-
Self: Future<Output = Result<T, E>>,
213-
F: Future<Output = Self::Output>,
215+
Self: std::future::Future<Output = Result<T, E>> + Sized,
216+
F: std::future::Future<Output = <Self as std::future::Future>::Output>,
214217
{
215218
TrySelect::new(self, other)
216219
}

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ macro_rules! extension_trait {
144144
};
145145

146146
// Parse the return type in an extension method.
147-
(@doc ($($head:tt)*) -> impl Future<Output = $out:ty> [$f:ty] $($tail:tt)*) => {
147+
(@doc ($($head:tt)*) -> impl Future<Output = $out:ty> $(+ $lt:lifetime)? [$f:ty] $($tail:tt)*) => {
148148
extension_trait!(@doc ($($head)* -> owned::ImplFuture<$out>) $($tail)*);
149149
};
150150
(@ext ($($head:tt)*) -> impl Future<Output = $out:ty> $(+ $lt:lifetime)? [$f:ty] $($tail:tt)*) => {

0 commit comments

Comments
 (0)