Skip to content

Commit 2a02903

Browse files
Restrict ManuallyDrop and AssertUnwindSafe impls
1 parent b38c598 commit 2a02903

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

library/core/src/mem/manually_drop.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
278278
unsafe impl<T: ?Sized> DerefPure for ManuallyDrop<T> {}
279279

280280
#[stable(feature = "from_wrapper_impls", since = "CURRENT_RUSTC_VERSION")]
281-
impl<T> From<T> for ManuallyDrop<T> {
281+
impl<T> From<T> for ManuallyDrop<T>
282+
where
283+
T: Copy,
284+
{
282285
#[inline(always)]
283286
fn from(value: T) -> Self {
284287
Self::new(value)

library/core/src/panic/unwind_safe.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,10 @@ impl<S: AsyncIterator> AsyncIterator for AssertUnwindSafe<S> {
313313
}
314314

315315
#[stable(feature = "from_wrapper_impls", since = "CURRENT_RUSTC_VERSION")]
316-
impl<T> From<T> for AssertUnwindSafe<T> {
316+
impl<T> From<T> for AssertUnwindSafe<T>
317+
where
318+
T: UnwindSafe,
319+
{
317320
#[inline(always)]
318321
fn from(value: T) -> Self {
319322
Self(value)

0 commit comments

Comments
 (0)