Rollup merge of #153945 - theemathas:unwind_safe_pointee_sized, r=scottmcm

Change `?Sized` to `PointeeSized` in `UnwindSafe` impls for pointers

Tracking issue: rust-lang/rust#144404.

This PR is similar to rust-lang/rust#152646.
This commit is contained in:
Stuart Cook
2026-03-18 18:37:35 +11:00
committed by GitHub
+7 -6
View File
@@ -2,6 +2,7 @@
use crate::cell::UnsafeCell;
use crate::fmt;
use crate::future::Future;
use crate::marker::PointeeSized;
use crate::ops::{Deref, DerefMut};
use crate::pin::Pin;
use crate::ptr::{NonNull, Unique};
@@ -178,17 +179,17 @@
// * Our custom AssertUnwindSafe wrapper is indeed unwind safe
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: ?Sized> !UnwindSafe for &mut T {}
impl<T: PointeeSized> !UnwindSafe for &mut T {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: RefUnwindSafe + ?Sized> UnwindSafe for &T {}
impl<T: RefUnwindSafe + PointeeSized> UnwindSafe for &T {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: RefUnwindSafe + ?Sized> UnwindSafe for *const T {}
impl<T: RefUnwindSafe + PointeeSized> UnwindSafe for *const T {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: RefUnwindSafe + ?Sized> UnwindSafe for *mut T {}
impl<T: RefUnwindSafe + PointeeSized> UnwindSafe for *mut T {}
#[unstable(feature = "ptr_internals", issue = "none")]
impl<T: UnwindSafe + ?Sized> UnwindSafe for Unique<T> {}
impl<T: UnwindSafe + PointeeSized> UnwindSafe for Unique<T> {}
#[stable(feature = "nonnull", since = "1.25.0")]
impl<T: RefUnwindSafe + ?Sized> UnwindSafe for NonNull<T> {}
impl<T: RefUnwindSafe + PointeeSized> UnwindSafe for NonNull<T> {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T> UnwindSafe for AssertUnwindSafe<T> {}