Skip to content
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

Use assert_* functions for all future/stream/sink/io combinators #2322

Merged
merged 1 commit into from
Jan 17, 2021

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Jan 15, 2021

Measures to prevent recurrence of #2311.

Refs: #2020
Closes #2320

@taiki-e taiki-e added A-stream Area: futures::stream A-sink Area: futures::sink A-future Area: futures::future A-io Area: futures::io labels Jan 15, 2021
@taiki-e taiki-e force-pushed the assert1 branch 2 times, most recently from 951ed2e to 318f0d0 Compare January 15, 2021 10:03
Comment on lines +257 to +258
// TODO: type mismatch resolving `<St as Stream>::Item == std::result::Result<Item, <Self as futures_sink::Sink<Item>>::Error>`
// assert_future::<Result<(), Self::Error>, _>(SendAll::new(self, stream))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this is not because the bounds are not satisfied, but because the compiler cannot resolve projection (assoc type).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since TryStream is sealed, I think it's safe to replace the TryStream bounds with Stream<Item = Result<..>> bounds, but for now, I'll leave it as it is.

Comment on lines +1341 to +1342
// TODO: type mismatch resolving `<Self as futures_core::Stream>::Item == std::result::Result<<Self as futures_core::TryStream>::Ok, <Self as futures_core::TryStream>::Error>`
// assert_future::<Result<(), Self::Error>, _>(Forward::new(self, sink))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@taiki-e taiki-e merged commit 4124111 into rust-lang:master Jan 17, 2021
@taiki-e taiki-e deleted the assert1 branch January 17, 2021 08:53
exrook pushed a commit to exrook/futures-rs that referenced this pull request Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-future Area: futures::future A-io Area: futures::io A-sink Area: futures::sink A-stream Area: futures::stream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add assertions for Future/Stream/Sink
1 participant