Remove P: Unpin bound on impl Stream for Pin

This commit is contained in:
Folyd 2021-12-17 11:14:02 +08:00
parent 23c2723269
commit 5c77116230

View File

@ -95,13 +95,13 @@ fn size_hint(&self) -> (usize, Option<usize>) {
#[unstable(feature = "async_stream", issue = "79024")] #[unstable(feature = "async_stream", issue = "79024")]
impl<P> Stream for Pin<P> impl<P> Stream for Pin<P>
where where
P: DerefMut + Unpin, P: DerefMut,
P::Target: Stream, P::Target: Stream,
{ {
type Item = <P::Target as Stream>::Item; type Item = <P::Target as Stream>::Item;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.get_mut().as_mut().poll_next(cx) <P::Target as Stream>::poll_next(self.as_deref_mut(), cx)
} }
fn size_hint(&self) -> (usize, Option<usize>) { fn size_hint(&self) -> (usize, Option<usize>) {