-
Notifications
You must be signed in to change notification settings - Fork 340
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
IntoStream for vec #213
IntoStream for vec #213
Conversation
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
@yoshuawuyts is this a specialization problem? e.g. rust-lang/rust#31844 ? Is this because
|
okay, I'm very confused by this. Rayon has a similar impl as we do, and they're not having the same problem. It seems like this may be something rather nuanced. edit: for reference, they have |
From conversations over chat, the next thing we should test is if it matters that we're using a foreign trait as part of the trait bound. Rayon doesn't do this, and we should check if only to cross it off. |
The thing that confuses me about this is that the following code compiles: trait IntoStream {}
trait Stream {}
impl<T: Send> IntoStream for Vec<T> {}
impl<T: Stream + Send> IntoStream for T {} These are exactly the same impls as what you seem to have. This is also exactly the same as what This is probably not the issue at all, but have you tried removing the |
This behavior is not a bug. For example, if Refs: rust-lang/rust#43426 |
Oh I didn't realize that Stream isn't defined in this crate. That's my bad then. Yes this isn't a bug. |
Even when working around this by making the bound our own Conversation about this has been happening in rust-lang/futures-rs#1879, but perhaps we should have a dedicated issue for this? |
Closing this PR because it isn't possible for all the reasons @taiki-e has listed. I've posted a summary of this PR in the streams tracking issue: #129 (comment). My hope is that we can add |
This WIP PR implements
IntoStream
forVec
, adding three new stream types for vec:vec::Stream
,vec::IntoStream
,vec::StreamMut
. We may want to extend this patch to also coverslice
, because if we'd follow std, vec should useStream
andStreamMut
types fromslice::*
.Ref #129.
cc/ @stjepang @sunjay
Error
I'm currently blocked on a problem with our bounds. Namely we do:
Which is causing the following error to show up:
I'm confused why this is happening, as
std::iter
has a similar impl. I'm worried this is some kind of orphan rule thing, but I don't quite get it. Getting help with this would be greatly appreciated!