Fix undocumented unsafe in AssertUnwindSafe impls
This commit is contained in:
parent
4e17994b2c
commit
6d988dc1e3
1 changed files with 2 additions and 0 deletions
|
@ -281,6 +281,7 @@ impl<F: Future> Future for AssertUnwindSafe<F> {
|
||||||
type Output = F::Output;
|
type Output = F::Output;
|
||||||
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
|
// SAFETY: pin projection. AssertUnwindSafe follows structural pinning.
|
||||||
let pinned_field = unsafe { Pin::map_unchecked_mut(self, |x| &mut x.0) };
|
let pinned_field = unsafe { Pin::map_unchecked_mut(self, |x| &mut x.0) };
|
||||||
F::poll(pinned_field, cx)
|
F::poll(pinned_field, cx)
|
||||||
}
|
}
|
||||||
|
@ -291,6 +292,7 @@ impl<S: Stream> Stream for AssertUnwindSafe<S> {
|
||||||
type Item = S::Item;
|
type Item = S::Item;
|
||||||
|
|
||||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> {
|
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> {
|
||||||
|
// SAFETY: pin projection. AssertUnwindSafe follows structural pinning.
|
||||||
unsafe { self.map_unchecked_mut(|x| &mut x.0) }.poll_next(cx)
|
unsafe { self.map_unchecked_mut(|x| &mut x.0) }.poll_next(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue