-
-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
the current code is :
impl<P> Body for Pin<P>
where
P: Unpin + ops::DerefMut,
P::Target: Body,
{
// ....
fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
Pin::get_mut(self).as_mut().poll_frame(cx)
}
// ....
}th correct code should be
impl<P> Body for Pin<P>
where
P: ops::DerefMut,
P::Target: Body,
{
// ....
fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
self.as_deref_mut().poll_frame(cx)
}
// ....
}without the Unpin bound. this likely has gone unnoticed as a !Unpin pinning pointer is a very strange idea, and all pinning pointers in std are Unpin.
but it is possible for such a type to exist, and thus this bound is making the api unnecessarily restrictive.
edit : i just saw as_deref_mut requires rust 1.84, which would be a significant bumb(prob unaceptably so) .
while there is no doubt this is sound in in earlier versions, i'm unsure wether the addition of unsafe code would be warranted.
maybe something to keep in mind for later , when/if http-body's msrv increases
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels