Skip to content

Commit 6d988dc

Browse files
committed
Fix undocumented unsafe in AssertUnwindSafe impls
1 parent 4e17994 commit 6d988dc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/panic/unwind_safe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ impl<F: Future> Future for AssertUnwindSafe<F> {
281281
type Output = F::Output;
282282

283283
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
284+
// SAFETY: pin projection. AssertUnwindSafe follows structural pinning.
284285
let pinned_field = unsafe { Pin::map_unchecked_mut(self, |x| &mut x.0) };
285286
F::poll(pinned_field, cx)
286287
}
@@ -291,6 +292,7 @@ impl<S: Stream> Stream for AssertUnwindSafe<S> {
291292
type Item = S::Item;
292293

293294
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> {
295+
// SAFETY: pin projection. AssertUnwindSafe follows structural pinning.
294296
unsafe { self.map_unchecked_mut(|x| &mut x.0) }.poll_next(cx)
295297
}
296298

0 commit comments

Comments
 (0)