-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ban manual implementation of TryFuture and TryStream #1776
Comments
I think adding |
Nope, there is no particular reason. It's probably a better option. |
Yeah, @aturon and I hit a bug w/ cycles in the trait checker when attempting to do that: trait Future {
type Output;
}
trait TryFuture: Future<Output = Result<Self::Ok, Self::Err>> {
type Ok;
type Err;
} gives
IIRC @nikomatsakis said this was fixed in chalk, but there's no ETA for the fix as far as I know. |
trait Future {
type Output;
}
trait TryFuture: Future<Output = Result<<Self as TryFuture>::Ok, <Self as TryFuture>::Err>> {
type Ok;
type Err;
} |
Nope, this still doesn't work.
|
So I believe #1777 is a good way at this time. |
Future<Output = Result<T, E>>
automatically implementsTryfuture
. Also it can call.await
andFutureExt
's methods withoutTryFuture::into_future
.Also, we may want to rewrite this trait to inherit
Future
in the future, so I think it makes sense to ban manual implementation for forward compatibility.https://github.com/rust-lang-nursery/futures-rs/blob/78c5d852ec24edcf630a4c569c1234d078416f4f/futures-core/src/future/mod.rs#L61-L63
I'm thinking of using the approach that
SliceIndex
uses, but there may be better ways.The text was updated successfully, but these errors were encountered: